test-gencat.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/sh
  2. # Test escape character handling in gencat.
  3. # Copyright (C) 2000-2026 Free Software Foundation, Inc.
  4. # This file is part of the GNU C Library.
  5. # The GNU C Library is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU Lesser General Public
  7. # License as published by the Free Software Foundation; either
  8. # version 2.1 of the License, or (at your option) any later version.
  9. # The GNU C Library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. # Lesser General Public License for more details.
  13. # You should have received a copy of the GNU Lesser General Public
  14. # License along with the GNU C Library; if not, see
  15. # <https://www.gnu.org/licenses/>.
  16. set -e
  17. common_objpfx=$1
  18. test_program_cmd_before_env=$2
  19. run_program_env=$3
  20. test_program_cmd_after_env=$4
  21. # Run the test program.
  22. ${test_program_cmd_before_env} \
  23. ${run_program_env} \
  24. NLSPATH=${common_objpfx}catgets/%N.%c.cat LC_ALL=ja_JP.SJIS \
  25. ${test_program_cmd_after_env} \
  26. > ${common_objpfx}catgets/test-gencat.out
  27. # Compare with the expected result.
  28. cmp - ${common_objpfx}catgets/test-gencat.out <<"EOF"
  29. LC_MESSAGES = ja_JP.SJIS
  30. sample1:ABCDEF:
  31. sample2:日本語:
  32. sample3:予定表:
  33. sample4:TEST TAB:
  34. sample5:機能 十種類:
  35. double slash\
  36. another line
  37. EOF
  38. res=$?
  39. cat <<EOF |
  40. #define AnotherSet 0x2 /* *standard input*:13 */
  41. #define AnotherFOO 0x1 /* *standard input*:14 */
  42. EOF
  43. cmp ${common_objpfx}catgets/test-gencat.h - || res=1
  44. exit $res