Home | History | Annotate | Line # | Download | only in tests
      1 #! /bin/sh
      2 
      3 # Test ObjectiveC extractor.
      4 
      5 tmpfiles=""
      6 trap 'rm -fr $tmpfiles' 1 2 3 15
      7 
      8 tmpfiles="$tmpfiles xg-ob-1.m"
      9 cat <<\EOF > xg-ob-1.m
     10 id str = _(@
     11 "conca" /* comment */
     12 @
     13 // another comment
     14  "tenated");
     15 
     16 _(@"foo") _ ( @"foo2" /* test */ )
     17 
     18 "_()"
     19 
     20 "  \" _(foo) \" /* comment "
     21 
     22 _ // test
     23 (@ /* comment " */ "test"
     24 @
     25 " test2"
     26 )
     27 
     28 NSLocalizedString(@"Information", @"")
     29 EOF
     30 
     31 tmpfiles="$tmpfiles xg-ob-1.po"
     32 : ${XGETTEXT=xgettext}
     33 ${XGETTEXT} --omit-header -k_ -kNSLocalizedString -d xg-ob-1 xg-ob-1.m
     34 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
     35 
     36 tmpfiles="$tmpfiles xg-ob-1.ok"
     37 cat <<\EOF > xg-ob-1.ok
     38 #: xg-ob-1.m:2
     39 msgid "concatenated"
     40 msgstr ""
     41 
     42 #: xg-ob-1.m:7
     43 msgid "foo"
     44 msgstr ""
     45 
     46 #: xg-ob-1.m:7
     47 msgid "foo2"
     48 msgstr ""
     49 
     50 #: xg-ob-1.m:14
     51 msgid "test test2"
     52 msgstr ""
     53 
     54 #: xg-ob-1.m:19
     55 msgid "Information"
     56 msgstr ""
     57 EOF
     58 
     59 : ${DIFF=diff}
     60 ${DIFF} xg-ob-1.ok xg-ob-1.po
     61 result=$?
     62 
     63 rm -fr $tmpfiles
     64 
     65 exit $result
     66