]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: mbsencode - test for HAVE_WIDECHAR
authorVaclav Dolezal <vdolezal@redhat.com>
Thu, 11 Jan 2018 10:11:31 +0000 (11:11 +0100)
committerVaclav Dolezal <vdolezal@redhat.com>
Thu, 11 Jan 2018 10:11:31 +0000 (11:11 +0100)
Test only safe-ascii as it should behave in the same way.

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
tests/ts/misc/mbsencode

index 8ebf73f46c7df4a82598b0d07ad24f738c00cf85..b483a53d1f3da1b09c0a9c3997ddeb0475eccf91 100755 (executable)
@@ -40,23 +40,41 @@ STRINGS=(
        $'\xe8\xe1\xf9\xa7'
 )
 
+if grep -q '^#define HAVE_WIDECHAR' ${top_builddir}/config.h ;then
+       HAVE_WIDECHAR=true
+else
+       HAVE_WIDECHAR=false
+fi
+
 ts_init_subtest "safe-ascii"
 $TS_HELPER_MBSENCODE --safe "${STRINGS[@]}" >> $TS_OUTPUT 2>&1
 ts_finalize_subtest
 
 ts_init_subtest "invalid-ascii"
-$TS_HELPER_MBSENCODE --invalid "${STRINGS[@]}" >> $TS_OUTPUT 2>&1
-ts_finalize_subtest
+if [ "$HAVE_WIDECHAR" = true ]; then
+       $TS_HELPER_MBSENCODE --invalid "${STRINGS[@]}" >> $TS_OUTPUT 2>&1
+       ts_finalize_subtest
+else
+       ts_skip_subtest 'No widechar support'
+fi
 
 ts_init_subtest "safe-utf8"
-LC_ALL=C.UTF-8 \
-$TS_HELPER_MBSENCODE --safe "${STRINGS[@]}" >> $TS_OUTPUT 2>&1
-ts_finalize_subtest
+if [ "$HAVE_WIDECHAR" = true ]; then
+       LC_ALL=C.UTF-8 \
+       $TS_HELPER_MBSENCODE --safe "${STRINGS[@]}" >> $TS_OUTPUT 2>&1
+       ts_finalize_subtest
+else
+       ts_skip_subtest 'No widechar support'
+fi
 
 ts_init_subtest "invalid-utf8"
-LC_ALL=C.UTF-8 \
-$TS_HELPER_MBSENCODE --invalid "${STRINGS[@]}" >> $TS_OUTPUT 2>&1
-ts_finalize_subtest
+if [ "$HAVE_WIDECHAR" = true ]; then
+       LC_ALL=C.UTF-8 \
+       $TS_HELPER_MBSENCODE --invalid "${STRINGS[@]}" >> $TS_OUTPUT 2>&1
+       ts_finalize_subtest
+else
+       ts_skip_subtest 'No widechar support'
+fi
 
 ts_finalize