xref: /aosp_15_r20/external/one-true-awk/testdir/T.latin1 (revision 9a7741de182b2776d7b30d6355f2585c0780a51b)
1*9a7741deSElliott Hughesecho T.latin1: tests of 8-bit input
2*9a7741deSElliott Hughes
3*9a7741deSElliott Hughesawk=${awk-../a.out}
4*9a7741deSElliott Hughes
5*9a7741deSElliott Hughes$awk '
6*9a7741deSElliott Hughes{ print $0 }
7*9a7741deSElliott Hughes' latin1 >foo1
8*9a7741deSElliott Hughes
9*9a7741deSElliott Hughesdiff latin1 foo1 || echo 'BAD: T.latin1 1'
10*9a7741deSElliott Hughes
11*9a7741deSElliott Hughes$awk '{ gsub(/\351/, "\370"); print }' latin1 >foo0
12*9a7741deSElliott Hughes$awk '{ gsub(/�/, "�"); print }' latin1 >foo1
13*9a7741deSElliott Hughesdiff foo0 foo1 || echo 'BAD: T.latin1 3'
14*9a7741deSElliott Hughes
15*9a7741deSElliott Hughes$awk '{ gsub(/[^\300-\370]/, ""); print }' latin1 >foo0
16*9a7741deSElliott Hughes$awk '{ gsub(/[^�-�]/, ""); print } ' latin1 >foo1
17*9a7741deSElliott Hughesdiff foo0 foo1 || echo 'BAD: T.latin1 4'
18*9a7741deSElliott Hughes
19*9a7741deSElliott Hughesecho  '/�/' >foo1
20*9a7741deSElliott Hughes$awk -f foo1 foo1 >foo2
21*9a7741deSElliott Hughes
22*9a7741deSElliott Hughesdiff foo1 foo2 || echo 'BAD: T.latin1 5'
23*9a7741deSElliott Hughes
24*9a7741deSElliott Hughes
25*9a7741deSElliott Hughesecho /[��]/ >foo1
26*9a7741deSElliott Hughes$awk -f foo1 foo1 >foo2
27*9a7741deSElliott Hughesdiff foo1 foo2 || echo 'BAD: T.latin1 6'
28*9a7741deSElliott Hughes
29*9a7741deSElliott Hughes
30*9a7741deSElliott Hughesecho 'This is a line.
31*9a7741deSElliott HughesPatterns like /[��]/ do not work yet. Example, run awk /[��]/
32*9a7741deSElliott Hughesover a file containing just �.
33*9a7741deSElliott HughesThis is another line.' >foo0
34*9a7741deSElliott Hughesecho 'Patterns like /[��]/ do not work yet. Example, run awk /[��]/
35*9a7741deSElliott Hughesover a file containing just �.' >foo1
36*9a7741deSElliott Hughes$awk '/[��]/' foo0 >foo2
37*9a7741deSElliott Hughesdiff foo1 foo2 || echo 'BAD: T.latin1 7'
38