mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
Update.
* catgets/Depend: New file. Add intl. * catgets/Makefile (tests): Add tst-catgets. (generated): Remove de.msg. (generated-dirs): Add de. Add dependency if tst-catgets output on de/libc.cat. * catgets/tst-catgets.c: New file.
This commit is contained in:
parent
82cd2e44f1
commit
04ba87901c
@ -1,5 +1,12 @@
|
||||
2000-09-06 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* catgets/Depend: New file. Add intl.
|
||||
* catgets/Makefile (tests): Add tst-catgets.
|
||||
(generated): Remove de.msg.
|
||||
(generated-dirs): Add de.
|
||||
Add dependency if tst-catgets output on de/libc.cat.
|
||||
* catgets/tst-catgets.c: New file.
|
||||
|
||||
* po/ja.po: New file.
|
||||
* po/el.po: Update from translation team.
|
||||
|
||||
|
1
catgets/Depend
Normal file
1
catgets/Depend
Normal file
@ -0,0 +1 @@
|
||||
intl
|
@ -28,6 +28,8 @@ others = gencat
|
||||
install-bin = gencat
|
||||
extra-objs = $(gencat-modules:=.o)
|
||||
|
||||
tests = tst-catgets
|
||||
|
||||
gencat-modules = xmalloc
|
||||
|
||||
# To find xmalloc.c
|
||||
@ -41,16 +43,21 @@ $(objpfx)gencat: $(gencat-modules:%=$(objpfx)%.o)
|
||||
catgets-CPPFLAGS := -DNLSPATH='"$(msgcatdir)/%L/%N:$(msgcatdir)/%L/LC_MESSAGES/%N:$(msgcatdir)/%l/%N:$(msgcatdir)/%l/LC_MESSAGES/%N:"' \
|
||||
-DHAVE_CONFIG_H
|
||||
|
||||
generated = de.msg de.cat test1.cat test1.h
|
||||
generated = de.msg test1.cat test1.h
|
||||
generated-dirs = de
|
||||
|
||||
tst-catgets-ENV = NLSPATH="$(objpfx)%l/%N.cat" LANG=de
|
||||
|
||||
ifneq ($(cross-compiling),yes)
|
||||
tests: $(objpfx)de.cat $(objpfx)test1.cat
|
||||
tests: $(objpfx)de/libc.cat $(objpfx)test1.cat
|
||||
# This test just checks whether the program produces any error or not.
|
||||
# The result is not tested.
|
||||
$(objpfx)test1.cat: test1.msg $(objpfx)gencat
|
||||
$(built-program-cmd) -H $(objpfx)test1.h $@ $<
|
||||
$(objpfx)de.cat: $(objpfx)de.msg $(objpfx)gencat
|
||||
$(objpfx)de/libc.cat: $(objpfx)de.msg $(objpfx)gencat
|
||||
-mkdir $(objpfx)de
|
||||
$(built-program-cmd) $@ $<
|
||||
$(objpfx)tst-catgets.out: $(objpfx)de/libc.cat
|
||||
|
||||
# Generate a non-simple input file.
|
||||
$(objpfx)de.msg: $(..)po/de.po
|
||||
|
66
catgets/tst-catgets.c
Normal file
66
catgets/tst-catgets.c
Normal file
@ -0,0 +1,66 @@
|
||||
#include <mcheck.h>
|
||||
#include <nl_types.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
static const char *msgs[] =
|
||||
{
|
||||
#define INPUT(str)
|
||||
#define OUTPUT(str) str,
|
||||
#include <intl/msgs.h>
|
||||
};
|
||||
#define nmsgs (sizeof (msgs) / sizeof (msgs[0]))
|
||||
|
||||
#define ROUNDS 5
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
int rnd;
|
||||
int result = 0;
|
||||
|
||||
mtrace ();
|
||||
|
||||
/* We do this a few times to stress the memory handling. */
|
||||
for (rnd = 0; rnd < ROUNDS; ++rnd)
|
||||
{
|
||||
nl_catd cd = catopen ("libc", 0);
|
||||
int cnt;
|
||||
|
||||
if (cd == (nl_catd) -1)
|
||||
{
|
||||
printf ("cannot load catalog: %m\n");
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Go through all the messages and compare the result. */
|
||||
for (cnt = 0; cnt < nmsgs; ++cnt)
|
||||
{
|
||||
char *trans;
|
||||
|
||||
trans = catgets (cd, 1, 1 + cnt,
|
||||
"+#+# is this comes backs it's an error");
|
||||
|
||||
if (trans == NULL)
|
||||
{
|
||||
printf ("catgets return NULL for %d\n", cnt);
|
||||
result = 1;
|
||||
}
|
||||
else if (strcmp (trans, msgs[cnt]) != 0)
|
||||
{
|
||||
printf ("expected \"%s\", got \"%s\"\n", msgs[cnt], trans);
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (catclose (cd) != 0)
|
||||
{
|
||||
printf ("catclose failed: %m\n");
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
Loading…
Reference in New Issue
Block a user