]> git.draconx.ca Git - dxcommon.git/blobdiff - tests/snippets.at
tests: Add some coverage of the gettext.mk snippet.
[dxcommon.git] / tests / snippets.at
index fe4eb0855a11dcdea87075e921e0de78de42009d..3794c7ee006be0da78a744d15c3edc73e316ae82 100644 (file)
@@ -1,4 +1,4 @@
-dnl Copyright © 2021-2022 Nick Bowler
+dnl Copyright © 2021-2023 Nick Bowler
 dnl
 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
 dnl This is free software: you are free to do what the fuck you want to.
@@ -120,3 +120,67 @@ AT_CHECK([make -s lib/glconfig.h])
 AT_CHECK([test ! -d lib/.deps && test ! -d lib/_deps && cat lib/glconfig.h])
 
 AT_CLEANUP
+
+AT_SETUP([gettext.mk .mo installation])
+
+cp "$srcdir/snippet/gettext.mk" "$srcdir/t/msgfmt.sh" .
+touch a.po b.po
+TEST_CONFIGURE_AC(
+[[AM_INIT_AUTOMAKE([foreign])
+AC_CONFIG_FILES([Makefile])
+]])
+
+AT_DATA([Makefile.am],
+[[MSGFMT = $(SHELL) $(top_srcdir)/msgfmt.sh
+EXTRA_DIST =
+MAINTAINERCLEANFILES =
+POFILES = a.po b.po
+MOFILES = a.mo b.mo
+include $(top_srcdir)/gettext.mk
+]])
+TEST_AUTORECONF
+
+mkdir build
+(cd build && TEST_CONFIGURE([--prefix="$at_group_dir/inst"], [../configure]))
+
+AT_CHECK([cd build &&
+  make DESTDIR="$at_group_dir" localedir=/l0 install],
+  [0], [ignore], [ignore])
+AT_CHECK([test -d inst || { find l0 | LC_ALL=C sort; }], [0],
+[[l0
+l0/a
+l0/a/LC_MESSAGES
+l0/a/LC_MESSAGES/test.mo
+l0/b
+l0/b/LC_MESSAGES
+l0/b/LC_MESSAGES/test.mo
+]])
+
+AT_CHECK([cd build &&
+  make DESTDIR="$at_group_dir" localedir=/l1 installdirs],
+  [0], [ignore], [ignore])
+AT_CHECK([test -d inst || { find l1 | LC_ALL=C sort; }], [0],
+[[l1
+l1/a
+l1/a/LC_MESSAGES
+l1/b
+l1/b/LC_MESSAGES
+]])
+
+AT_CHECK([cd build &&
+  make DESTDIR="$at_group_dir" localedir=/l2 MOFILES= install installdirs],
+  [0], [ignore], [ignore])
+AT_CHECK([test ! -d inst && test ! -d l2])
+
+AT_CHECK([cd build &&
+  make DESTDIR="$at_group_dir" localedir=/l0 MOFILES= uninstall],
+  [0], [ignore], [ignore])
+AT_CHECK([test -d inst || { find l0 | LC_ALL=C sort; }], [0],
+[[l0
+l0/a
+l0/a/LC_MESSAGES
+l0/b
+l0/b/LC_MESSAGES
+]])
+
+AT_CLEANUP