diff options
Diffstat (limited to 'test/nls')
-rw-r--r-- | test/nls/Makefile.am | 34 | ||||
-rw-r--r-- | test/nls/Makefile.in | 649 | ||||
-rw-r--r-- | test/nls/check-localedir.in | 25 | ||||
-rw-r--r-- | test/nls/check-nls.in | 40 | ||||
-rw-r--r-- | test/nls/print-localedir.c | 11 | ||||
-rw-r--r-- | test/nls/test-codeset.c | 209 | ||||
-rw-r--r-- | test/nls/test-nls.c | 105 |
7 files changed, 1073 insertions, 0 deletions
diff --git a/test/nls/Makefile.am b/test/nls/Makefile.am new file mode 100644 index 0000000..3f0b1ab --- /dev/null +++ b/test/nls/Makefile.am @@ -0,0 +1,34 @@ +nlstestscripts = check-localedir.sh # check-codeset.sh + +codeset_tests = test-codeset-default test-codeset-latin1 test-codeset-utf-8 + +TESTS = $(nlstestscripts) + +check_SCRIPTS = $(nlstestscripts) + +check_PROGRAMS = print-localedir # $(codeset_tests) + +# test_codeset_default_SOURCES = test-codeset.c +# test_codeset_default_CPPFLAGS = \ +# $(AM_CPPFLAGS) $(CPPFLAGS) \ +# -DCODESET_DEFAULT + +# test_codeset_utf_8_SOURCES = test-codeset.c +# test_codeset_utf_8_CPPFLAGS = \ +# $(AM_CPPFLAGS) $(CPPFLAGS) \ +# -DCODESET_UTF_8 + +# test_codeset_latin1_SOURCES = test-codeset.c +# test_codeset_latin1_CPPFLAGS = \ +# $(AM_CPPFLAGS) $(CPPFLAGS) \ +# -DCODESET_LATIN1 + +CLEANFILES = $(check_SCRIPTS) + +# test_nls_LDADD = $(top_builddir)/libexif/libexif.la $(INTLLIBS) + +EXTRA_DIST = check-localedir.in check-nls.in test-nls.c test-codeset.c + +.in.sh: Makefile + sed 's|@top_builddir\@|$(top_builddir)|g;s|@localedir\@|$(localedir)|g;s|@PRINT_LOCALEDIR\@|./print-localedir$(EXEEXT)|g;s|@build_alias\@|$(build_alias)|g;s|@host_alias\@|$(host_alias)|g;s|@codeset_tests\@|$(codeset_tests)|g;s|@DESTDIR\@|$(DESTDIR)|g' < $< > $@ + chmod +x $@ diff --git a/test/nls/Makefile.in b/test/nls/Makefile.in new file mode 100644 index 0000000..9ad742e --- /dev/null +++ b/test/nls/Makefile.in @@ -0,0 +1,649 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +check_PROGRAMS = print-localedir$(EXEEXT) +subdir = test/nls +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4m/gp-check-shell-environment.m4 \ + $(top_srcdir)/m4m/gp-config-msg.m4 \ + $(top_srcdir)/m4m/gp-documentation.m4 \ + $(top_srcdir)/m4m/gp-gettext-hack.m4 \ + $(top_srcdir)/m4m/stdint.m4 $(top_srcdir)/auto-m4/gettext.m4 \ + $(top_srcdir)/auto-m4/iconv.m4 $(top_srcdir)/auto-m4/lib-ld.m4 \ + $(top_srcdir)/auto-m4/lib-link.m4 \ + $(top_srcdir)/auto-m4/lib-prefix.m4 \ + $(top_srcdir)/auto-m4/libtool.m4 \ + $(top_srcdir)/auto-m4/ltoptions.m4 \ + $(top_srcdir)/auto-m4/ltsugar.m4 \ + $(top_srcdir)/auto-m4/ltversion.m4 \ + $(top_srcdir)/auto-m4/lt~obsolete.m4 \ + $(top_srcdir)/auto-m4/nls.m4 $(top_srcdir)/auto-m4/po.m4 \ + $(top_srcdir)/auto-m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +print_localedir_SOURCES = print-localedir.c +print_localedir_OBJECTS = print-localedir.$(OBJEXT) +print_localedir_LDADD = $(LDADD) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = print-localedir.c +DIST_SOURCES = print-localedir.c +ETAGS = etags +CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CPPFLAGS = @AM_CPPFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AM_LDFLAGS = @AM_LDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOT = @DOT@ +DOXYGEN = @DOXYGEN@ +DOXYGEN_OUTPUT_DIR = @DOXYGEN_OUTPUT_DIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +HAVE_DOT = @HAVE_DOT@ +HTML_APIDOC_DIR = @HTML_APIDOC_DIR@ +HTML_APIDOC_INTERNALS_DIR = @HTML_APIDOC_INTERNALS_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBEXIF_AGE = @LIBEXIF_AGE@ +LIBEXIF_CURRENT = @LIBEXIF_CURRENT@ +LIBEXIF_CURRENT_MIN = @LIBEXIF_CURRENT_MIN@ +LIBEXIF_REVISION = @LIBEXIF_REVISION@ +LIBEXIF_VERSION_INFO = @LIBEXIF_VERSION_INFO@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +nlstestscripts = check-localedir.sh # check-codeset.sh +codeset_tests = test-codeset-default test-codeset-latin1 test-codeset-utf-8 +TESTS = $(nlstestscripts) +check_SCRIPTS = $(nlstestscripts) + +# test_codeset_default_SOURCES = test-codeset.c +# test_codeset_default_CPPFLAGS = \ +# $(AM_CPPFLAGS) $(CPPFLAGS) \ +# -DCODESET_DEFAULT + +# test_codeset_utf_8_SOURCES = test-codeset.c +# test_codeset_utf_8_CPPFLAGS = \ +# $(AM_CPPFLAGS) $(CPPFLAGS) \ +# -DCODESET_UTF_8 + +# test_codeset_latin1_SOURCES = test-codeset.c +# test_codeset_latin1_CPPFLAGS = \ +# $(AM_CPPFLAGS) $(CPPFLAGS) \ +# -DCODESET_LATIN1 +CLEANFILES = $(check_SCRIPTS) + +# test_nls_LDADD = $(top_builddir)/libexif/libexif.la $(INTLLIBS) +EXTRA_DIST = check-localedir.in check-nls.in test-nls.c test-codeset.c +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .in .lo .o .obj .sh +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/nls/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu test/nls/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +print-localedir$(EXEEXT): $(print_localedir_OBJECTS) $(print_localedir_DEPENDENCIES) + @rm -f print-localedir$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(print_localedir_OBJECTS) $(print_localedir_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print-localedir.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes$$std"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +.in.sh: Makefile + sed 's|@top_builddir\@|$(top_builddir)|g;s|@localedir\@|$(localedir)|g;s|@PRINT_LOCALEDIR\@|./print-localedir$(EXEEXT)|g;s|@build_alias\@|$(build_alias)|g;s|@host_alias\@|$(host_alias)|g;s|@codeset_tests\@|$(codeset_tests)|g;s|@DESTDIR\@|$(DESTDIR)|g' < $< > $@ + chmod +x $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/test/nls/check-localedir.in b/test/nls/check-localedir.in new file mode 100644 index 0000000..9636d87 --- /dev/null +++ b/test/nls/check-localedir.in @@ -0,0 +1,25 @@ +#!/bin/sh + +localedir="@localedir@" +build_alias="@build_alias@" +host_alias="@host_alias@" + +binlocaledir="`@PRINT_LOCALEDIR@ 2> /dev/null`" + +if test "${localedir}" = "${binlocaledir}"; then + echo "Makefile and binary agree on localedir \`${localedir}'. Good." + exit 0 +else + echo "Makefile and binary disagree on localedir. Bad." + echo " - Makefile says \`${localedir}'." + echo " - binary says \`${binlocaledir}'." + + if test "${build_alias}" != "${host_alias}"; then + echo "However, you are cross-compiling, so this does not necessarily" + echo "have consequences." + exit 0 + else + echo "Error: Could not determine binary localedir." + exit 1 + fi +fi diff --git a/test/nls/check-nls.in b/test/nls/check-nls.in new file mode 100644 index 0000000..f484940 --- /dev/null +++ b/test/nls/check-nls.in @@ -0,0 +1,40 @@ +#!/bin/sh + +top_builddir="@top_builddir@" +localedir="@localedir@" + +destdir="$(pwd)/tmp-root" + +if test -d "${top_builddir}"; then :; else + echo "top_builddir \`${top_builddir}' not found" + exit 3 +fi + +echo -n "Test installation of translated messages..." +if (cd "${top_builddir}/po" && make DESTDIR="${destdir}" install > /dev/null 2>&1); then + echo " done." +else + echo " FAILED." + echo "Could not create test installation of translated messages" + exit 2 +fi + +binlocaledir="$(./print-localedir)" +mylocaledir="${destdir}${binlocaledir}" +if test -d "${destdir}${binlocaledir}"; then + echo "Test installation contains localedir \`${binlocaledir}'." +else + echo "localedir \`${binlocaledir}' does not exist" + exit 1 +fi + +testnls="./test-nls ${mylocaledir}" +if ${testnls}; then + echo "NLS test successful" + rm -rf "${destdir}" + exit 0 +else + echo "NLS test failed, not removing test installation from" + echo " ${destdir}" + exit 1 +fi diff --git a/test/nls/print-localedir.c b/test/nls/print-localedir.c new file mode 100644 index 0000000..50e605b --- /dev/null +++ b/test/nls/print-localedir.c @@ -0,0 +1,11 @@ +#include "config.h" +#include "libexif/i18n.h" + +#include <stdio.h> + +int main() +{ + puts(LOCALEDIR); + puts("\n"); + return 0; +} diff --git a/test/nls/test-codeset.c b/test/nls/test-codeset.c new file mode 100644 index 0000000..fa47f79 --- /dev/null +++ b/test/nls/test-codeset.c @@ -0,0 +1,209 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <i18n.h> +#include <langinfo.h> +#include <libintl.h> + +/* return whether byte strings are equal or not. + * NULL strings are never equal + */ +static int my_streq(const char *va, const char *vb) { + const char *a = va; + const char *b = vb; + int i; + if ((NULL == a) || (NULL == b)) { + return 0; + } + for (i=0; a[i] != '\0' && b[i] != '\0'; i++) { + if (a[i] != b[i]) { + return 0; + } + } + return 1; +} + +#if defined(CODESET_UTF_8) +#define MY_CODESET "UTF-8" +#elif defined(CODESET_LATIN1) +#define MY_CODESET "iso-8859-1" +#elif defined(CODESET_DEFAULT) +#define MY_CODESET "default" +#define bind_textdomain_codeset(domain,codeset) \ + MY_CODESET +#else +#error Define one of the CODESET_* macros! +#endif + +typedef struct { + char *locale; + char *orig; + char *latin1; + char *utf8; +} TestCase; + +const TestCase testcases[] = { + { "de_DE", + N_("High saturation"), + /* ä latin1 oct 333 hex e4 dec 228 */ + "Hohe S\344ttigung", + /* ä utf-8 oct 303 244 hex c3 a4 dec 195 164 */ + "Hohe S\303\244ttigung" }, + { "fr_FR", + N_("Not defined"), + /* é latin1 oct 351 hex e9 dec 233 */ + "Non d\233fini", + /* é utf-8 oct 303 251 hex c3 dec 195 */ + "Non d\303\251fini" + }, + { "es_ES", + N_("High saturation"), + /* ó latin1 oct hex dec 243 */ + "Alta saturaci\363n", + /* ó utf-8 oct hex c3 b3 dec */ + "Alta saturaci\303\263n" + }, + { NULL, NULL, NULL, NULL } +}; + + +static int check(const int i) +{ + const char *oldtextdomain = textdomain(NULL); + const char *newtextdomain = textdomain(GETTEXT_PACKAGE); + + const char *newcodeset = MY_CODESET; + const char *oldcodeset = bind_textdomain_codeset(GETTEXT_PACKAGE, NULL); + const char *realcodeset = bind_textdomain_codeset(GETTEXT_PACKAGE, MY_CODESET); + + const char *orig = testcases[i].orig; + const char *transl = gettext(testcases[i].orig); + const char *latin1 = testcases[i].latin1; + const char *utf8 = testcases[i].utf8; + + printf( + "Old textdomain: %s\n" + "New textdomain: %s\n", + oldtextdomain, + newtextdomain + ); + + if (NULL != oldcodeset) { + printf( + "Old codeset: \"%s\" (locale default)\n", + nl_langinfo(CODESET) + ); + } else { + printf( + "Old codeset: \"%s\"\n", + oldcodeset + ); + } + + printf( + "Wanted codeset: %s\n" + "Real codeset: %s\n", + newcodeset, + realcodeset + ); + + printf( + "Original: %s\n" + "Translated: %s\n" + "iso-8859-1: %s\n" + "utf-8: %s\n", + orig, + transl, + latin1, + utf8 + ); + +#if defined(CODESET_UTF_8) + return (my_streq(transl, utf8)); +#elif defined(CODESET_LATIN_1) + return (my_streq(transl, latin1)); +#else + /* make sure my_streq is used once */ + return (my_streq(orig, orig)); +#endif +} + + +static int checks() +{ + int i; + + const char *localeenv = getenv("LOCALEDIR"); + const char *localedir = (localeenv!=NULL)?localeenv:LOCALEDIR; + const char *msgcatdir = bindtextdomain(GETTEXT_PACKAGE, localedir); + + /* set locale to env settings */ + const char *oldlocale = setlocale(LC_ALL, NULL); + const char *newlocale = setlocale(LC_ALL, ""); + + if (localeenv != NULL) { + printf("Msg catalog dir: %s (from environment variable LOCALEDIR\n", + msgcatdir); + } else { + printf("Msg catalog dir: %s\n", msgcatdir); + } + + if (newlocale == NULL) { + printf("Locale not available: \"%s\"\n", newlocale); + printf("Aborting without error.\n"); + return 1; + } + + + printf( + "Old locale: %s\n" + "New locale: %s\n", + oldlocale, + newlocale + ); + + for (i=0; testcases[i].locale != NULL; i++) { + const int localelen = strlen(testcases[i].locale); + if (strncmp(newlocale, testcases[i].locale, localelen) == 0) { + return check(i); + } + } + + printf("No test case found for locale: %s\n", newlocale); + return 1; +} + + +int main(int argc, char *argv[]) +{ + if (argc > 1) { + if ((argc == 2) && (strcmp("--list", argv[1]) == 0)) { + int i; + for (i=0; testcases[i].locale != NULL; i++) { + printf("%s\n", testcases[i].locale); + } + return 0; + } else { + int i; + fprintf(stderr, "Illegal command line. Aborting.\n"); + fprintf(stderr, "argc: %03d\n", argc); + for (i=0; i<argc; i++) { + fprintf(stderr, "%03d \"%s\"\n", i, argv[i]); + } + return 1; + } + } else { + int ret = checks(); + printf("Test result: %s\n", (ret)?"success":"failure"); + return (ret)?0:1; + } + return -1; +} + +/* + * Local Variables: + * mode:c + * c-basic-offset: 8 + * End: + */ diff --git a/test/nls/test-nls.c b/test/nls/test-nls.c new file mode 100644 index 0000000..6080d7a --- /dev/null +++ b/test/nls/test-nls.c @@ -0,0 +1,105 @@ +#include "config.h" + +#include "i18n.h" +#include <locale.h> + +#include <stdio.h> +#include <string.h> + +struct _testcase { + char *locale; + char *untranslated; + char *expected; +}; + +typedef struct _testcase testcase; + +/* Translators: Just ignore the stuff in the test subdirectory. */ +static testcase testcases[] = { + { "de_DE.UTF-8", + N_("[DO_NOT_TRANSLATE_THIS_MARKER]"), + "[DO_NOT_TRANSLATE_THIS_MARKER_de]" }, + { "C", + N_("[DO_NOT_TRANSLATE_THIS_MARKER]"), + N_("[DO_NOT_TRANSLATE_THIS_MARKER]") }, +}; + +int main(int argc, char *argv[]) +{ + char *localedir; + int i; + + if (argc != 2) { + puts("Syntax: test-nls <localedir>\n"); + return 1; + } + + localedir = argv[1]; + + do { + const char *newloc = setlocale(LC_ALL, NULL); + printf("Default locale: %s\n", newloc); + } while (0); + + + for (i=0; i < sizeof(testcases)/sizeof(testcases[0]); i++) { + char *locale = testcases[i].locale; + char *untranslated = testcases[i].untranslated; + char *expected = testcases[i].expected; + char *translation; + + if (1) { + printf("setlocale(\"%s\")\n", locale); + const char *actual_locale = setlocale(LC_MESSAGES, locale); + if (actual_locale == NULL) { + fprintf(stderr, "Error: Cannot set locale to %s.\n", locale); + return 4; + } + printf("new locale: %s\n", actual_locale); + } + + if (1) { + const char *basedir = bindtextdomain(GETTEXT_PACKAGE, localedir); + printf("message basedir: %s\n", basedir); + } + + if (1) { + const char *domain = textdomain(GETTEXT_PACKAGE); + printf("message domain: %s\n", domain); + } + + if (1) { + const char *codeset = bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + printf("message codeset: %s\n", codeset); + } + + puts("before translation"); + translation = gettext(untranslated); + puts("after translation"); + + if (strcmp(expected, translation) != 0) { + fprintf(stderr, + "locale: %s\n" + "localedir: %s\n" + "untranslated: %s\n" + "expected: %s\n" + "translation: %s\n" + "Error: translation != expected\n", + locale, + localedir, + untranslated, + expected, + translation); + + return 1; + } else { + fprintf(stderr, + "expected: %s\n" + "translation: %s\n" + "Match!\n", + expected, + translation); + } + } + return 0; +} |