diff --git a/configure.ac b/configure.ac index 541b490..1e8bd3b 100644 --- a/configure.ac +++ b/configure.ac @@ -17,9 +17,12 @@ dnl Platform check. AS_CASE([$host], [*-*-msys* | *-*-mingw*], [is_mingw=y ], [*-*-cygwin* ], [is_cygwin=y ], - [*-*-solaris* ], [os_solaris=y]) + [*-*-solaris* ], [os_solaris=y], + [*-*-freebsd* ], [os_freebsd=y]) AC_SUBST(is_mingw) AC_SUBST(is_cygwin) +AC_SUBST(os_solaris) +AC_SUBST(os_freebsd) AM_CONDITIONAL([OS_WINDOWS], [test "x$is_mingw" != x]) dnl I18N @@ -99,8 +102,7 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([#include ], [AC_MSG_RESULT([native/libiconv])], [AC_RUN_IFELSE([AC_LANG_PROGRAM([#include ], [return (g_iconv_open("UTF-8","646") == (GIConv) -1);])], - [AC_MSG_RESULT([solaris]) - AC_SUBST(solaris_iconv)], + [AC_MSG_RESULT([solaris])], [AC_MSG_RESULT([unknown]) AC_MSG_ERROR([dnl iconv() implementation used by glib2 is not recognized, which diff --git a/test/atlocal.in b/test/atlocal.in index dcd5935..4a86480 100644 --- a/test/atlocal.in +++ b/test/atlocal.in @@ -14,6 +14,7 @@ awk="@AWK@" is_mingw="test x@is_mingw@ != x" is_cygwin="test x@is_cygwin@ != x" os_solaris="test x@os_solaris@ != x" +os_freebsd="test x@os_freebsd@ != x" # abbrev progf="$abs_top_builddir/src/rifiuti" @@ -23,6 +24,8 @@ sample="$abs_srcdir/samples" # platform specific stuff if $os_solaris; then gbk_enc_name=GBK + ebcdic_enc_name=IBM-037 else gbk_enc_name=CP936 + ebcdic_enc_name=IBM037 fi diff --git a/test/test_encoding.at b/test/test_encoding.at index bf74919..9c328ac 100644 --- a/test/test_encoding.at +++ b/test/test_encoding.at @@ -9,27 +9,73 @@ dnl AT_SETUP([Unicode characters in file argument]) AT_KEYWORDS([encoding]) AT_CHECK([ - cp $sample/japanese-path-file.txt expout + $as_ln_s $sample/japanese-path-file.txt expout cd $sample $progf ./ごみ箱/INFO2-empty ],, [expout]) AT_CHECK([ rm -f expout - cp $sample/japanese-path-dir.txt expout + $as_ln_s $sample/japanese-path-dir.txt expout cd $sample $progd ./ごみ箱/dir-empty ],, [expout]) AT_CLEANUP +AT_SETUP([Legacy path encoding - correct]) +AT_KEYWORDS([info2 encoding]) +_r2_basic_compare([$progf -l $gbk_enc_name INFO2-sample1], [INFO2-sample1-alt.txt]) +AT_CLEANUP + +AT_SETUP([Legacy path encoding - illegal (1)]) +AT_KEYWORDS([info2 encoding]) + +AT_DATA([experr-win],[dnl +.* is not a valid encoding on this system\. +Please visit following web page .* + + https://.* +]) + +AT_DATA([experr-unix],[dnl +.* is not a valid encoding on this system\. +Run 'iconv -l' for list of supported encodings\. +]) + +AX_AT_CHECK_PATTERN([ + if $is_mingw ; then + $as_ln_s experr-win experr + else + $as_ln_s experr-unix experr + fi + cd $sample + $progf -l xxx INFO2-sample1 +], 1,, [experr]) +AT_CLEANUP + +dnl +dnl Despite IBM037 encoding being supported in Freebsd iconv +dnl (and usable in cmdline), glib can't make use of it +dnl +AT_SETUP([Legacy path encoding - illegal (2)]) +AT_KEYWORDS([info2 encoding]) +AT_XFAIL_IF([$os_freebsd]) +AX_AT_CHECK_PATTERN([ + cd $sample + $progf -l $ebcdic_enc_name INFO2-sample1 +], 1,, [dnl +.* can't possibly be a code page or compatible encoding .* +]) +AT_CLEANUP + dnl dnl Original file in Windows ANSI (CP1252), but users attempts -dnl to treat it as Shift-JIS, and fails +dnl to treat it as Shift-JIS, and got hex escapes as result dnl -AT_SETUP([Err when converting from wrong charset]) +AT_SETUP([Legacy path encoding - wrong]) AT_KEYWORDS([encoding]) AT_CHECK([ - cp $sample/INFO2-sample2-wrong-enc.txt expout + $as_ln_s $sample/INFO2-sample2-wrong-enc.txt expout cd $sample $progf -l CP932 INFO2-sample2 ], 5, [expout], [ignore]) diff --git a/test/test_parse_info2.at b/test/test_parse_info2.at index a37b873..a72d063 100644 --- a/test/test_parse_info2.at +++ b/test/test_parse_info2.at @@ -37,8 +37,3 @@ AT_SETUP([INFO2 Sample 6 - XP/03]) AT_KEYWORDS([info2]) _r2_basic_compare([$progf INFO2-sample1], [INFO2-sample1.txt]) AT_CLEANUP - -AT_SETUP([Legacy path names]) -AT_KEYWORDS([info2]) -_r2_basic_compare([$progf -l $gbk_enc_name INFO2-sample1], [INFO2-sample1-alt.txt]) -AT_CLEANUP