1 #!/bin/sh 2 3 # Some tests for C# support 4 5 tmpfiles="" 6 trap 'rm -fr $tmpfiles' 1 2 3 15 7 8 tmpfiles="$tmpfiles xg-cs-1.cs" 9 cat <<EOF > xg-cs-1.cs 10 using GNU.Gettext; 11 class TestCase { 12 public TestCase() { 13 GettextResourceManager rm = new GettextResourceManager("test"); 14 // standard usage 15 String test1 = rm.GetString("Test String 1"); 16 /* C style comment */ 17 String test2 = rm.GetString("Test String 2"); 18 // C# "multiline" string 19 String test3 = rm.GetString("Test " + 20 "String " + 21 "3"); 22 // empty string 23 String test4 = rm.GetString(""); 24 #if false 25 // commented out through #if 26 String test5 = rm.GetString("Test String 5"); 27 #endif 28 } 29 } 30 EOF 31 32 tmpfiles="$tmpfiles xg-cs-1.po" 33 : ${XGETTEXT=xgettext} 34 ${XGETTEXT} --omit-header --no-location -c -d xg-cs-1 xg-cs-1.cs 35 test $? = 0 || { rm -fr $tmpfiles; exit 1; } 36 37 tmpfiles="$tmpfiles xg-cs-1.ok" 38 cat <<EOF > xg-cs-1.ok 39 #. standard usage 40 msgid "Test String 1" 41 msgstr "" 42 43 #. C style comment 44 msgid "Test String 2" 45 msgstr "" 46 47 #. C# "multiline" string 48 msgid "Test String 3" 49 msgstr "" 50 51 #. empty string 52 msgid "" 53 msgstr "" 54 55 #. commented out through #if 56 msgid "Test String 5" 57 msgstr "" 58 EOF 59 60 : ${DIFF=diff} 61 ${DIFF} xg-cs-1.ok xg-cs-1.po 62 result=$? 63 64 rm -fr $tmpfiles 65 66 exit $result 67