1# Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
2#
3# Permission to use, copy, modify, and distribute this software
4# is freely granted, provided that this notice is preserved.
5#
6
7load_lib checkoutput.exp
8
9# Don't run this test if newlib's build does not support multibyte encodings.
10set newlib_header_name "$objdir/targ-include/newlib.h"
11if [file exists $newlib_header_name] {
12    set newlib_header_fid [open $newlib_header_name r]
13    set newlib_header_text [read $newlib_header_fid]
14    close $newlib_header_fid
15    if {![regexp "#define _MB_CAPABLE" $newlib_header_text] || \
16            [regexp "#define _MB_LEN_MAX 1" $newlib_header_text]} {
17        return
18    }
19}
20
21set expected_output {
22"Set C-UTF-8 locale."
23"* U-00000000"
24"* U-00000080"
25"* U-00000800"
26"* U-00010000"
27"* U-00200000"
28"* U-04000000"
29"* U-0000007f"
30"* U-000007ff"
31"* U-0000ffff"
32"* U-001fffff"
33"* U-03ffffff"
34"* U-7fffffff"
35"* U-0000d7ff"
36"* U-0000e000"
37"* U-0000fffd"
38"* U-0010ffff"
39"* U-00110000"
40"* 1 Invalid"
41"* 1 Invalid"
42"* 2 Invalid"
43"* 3 Invalid"
44"* 4 Invalid"
45"* 5 Invalid"
46"* 6 Invalid"
47"* 7 Invalid"
48"* 64 Invalid"
49"* 32 Invalid"
50"* 16 Invalid"
51"* 8 Invalid"
52"* 4 Invalid"
53"* 2 Invalid"
54"* 1 Invalid"
55"* 1 Invalid"
56"* 1 Invalid"
57"* 1 Invalid"
58"* 1 Invalid"
59"* 1 Invalid"
60"* 1 Invalid"
61"* 1 Invalid"
62"* 1 Invalid"
63"* 1 Invalid"
64"* 1 Invalid"
65"* 1 Invalid"
66"* 1 Invalid"
67"* 1 Invalid"
68"* 1 Invalid"
69"* 1 Invalid"
70"* 1 Invalid"
71"* 1 Invalid"
72"* 1 Invalid"
73"* 1 Invalid"
74"* 1 Invalid"
75"* 1 Invalid"
76"* 1 Invalid"
77"* 1 Invalid"
78"* 1 Invalid"
79"* 1 Invalid"
80"* 1 Invalid"
81"* 1 Invalid"
82"* 1 Invalid"
83"* 1 Invalid"
84"* 1 Invalid"
85"* 1 Invalid"
86"* 1 Invalid"
87"* 1 Invalid"
88"* 1 Invalid"
89"* 1 Invalid"
90"* 1 Invalid"
91"* 1 Invalid"
92"* 1 Invalid"
93"* 1 Invalid"
94"* 1 Invalid"
95"* 1 Invalid"
96"* 1 Invalid"
97"* 1 Invalid"
98}
99
100newlib_check_output UTF-8.c $expected_output
101