Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / format-python-brace-1
index 1c4f468..601b023 100755 (executable)
@@ -1,14 +1,15 @@
 #! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
 
 # Test recognition of Python brace format strings.
 
-tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
-
-tmpfiles="$tmpfiles f-pyb-1.data"
 cat <<\EOF > f-pyb-1.data
 # Invalid: no argument
 "abc"
+# Invalid: escaped braces
+"abc{{}}"
+# Valid: a numeric argument
+"abc{0}"
 # Valid: a named argument
 "abc{value}"
 # Invalid: an empty name
@@ -25,12 +26,22 @@ cat <<\EOF > f-pyb-1.data
 "abc{value[name]}"
 # Invalid: unterminated getitem operator
 "abc{value[name}"
+# Invalid: unterminated getitem operator
+"abc{value[0}"
+# Invalid: unknown character in getitem operator
+"abc{value[!]}"
 # Valid: format specifier
 "abc{value:0}"
+# Valid: standard format specifier
+"abc{value:<<-#012.34e}"
+# Invalid: non-standard format specifier
+"abc{value:<c>}"
 # Valid: nested format specifier
-"abc{value:0{foo}0}"
+"abc{value:{foo}}"
 # Invalid: too many nesting of format specifier
-"abc{value:0{foo:0}0}"
+"abc{value:{foo:0}}"
+# Invalid: nested format specifier, in the middle of other format specifiers
+"abc{value:0{foo}0}"
 EOF
 
 : ${XGETTEXT=xgettext}
@@ -38,7 +49,6 @@ n=0
 while read comment; do
   read string
   n=`expr $n + 1`
-  tmpfiles="$tmpfiles f-pyb-1-$n.in f-pyb-1-$n.po"
   cat <<EOF > f-pyb-1-$n.in
 gettext(${string});
 EOF
@@ -68,6 +78,4 @@ EOF
   rm -f f-pyb-1-$n.in f-pyb-1-$n.po
 done < f-pyb-1.data
 
-rm -fr $tmpfiles
-
 exit 0