xref: /aosp_15_r20/external/one-true-awk/testdir/T.main (revision 9a7741de182b2776d7b30d6355f2585c0780a51b)
1*9a7741deSElliott Hughesecho T.main: misc tests of arguments in main
2*9a7741deSElliott Hughes
3*9a7741deSElliott Hughesawk=${awk-../a.out}
4*9a7741deSElliott Hughes
5*9a7741deSElliott Hughesrm -f core
6*9a7741deSElliott Hughes
7*9a7741deSElliott Hughes# test -d option
8*9a7741deSElliott Hughes
9*9a7741deSElliott Hughes
10*9a7741deSElliott Hughes
11*9a7741deSElliott Hughesecho hello | $awk -d '{print}' >foo1
12*9a7741deSElliott Hughesif test -r core; then echo 1>&2 "BAD: T.main awk -d dropped core"; fi
13*9a7741deSElliott Hughes
14*9a7741deSElliott Hughesecho 'a::b::c' >foo
15*9a7741deSElliott Hughes$awk -F:: '{print NF}' foo >foo1
16*9a7741deSElliott Hughesecho '3' >foo2
17*9a7741deSElliott Hughesdiff foo1 foo2 || echo 'bad: awk -F::'
18*9a7741deSElliott Hughes
19*9a7741deSElliott Hughesecho 'a::b::c' >foo
20*9a7741deSElliott Hughes$awk -F :: '{print NF}' foo >foo1
21*9a7741deSElliott Hughesecho '3' >foo2
22*9a7741deSElliott Hughesdiff foo1 foo2 || echo 'bad: awk -F ::'
23*9a7741deSElliott Hughes
24*9a7741deSElliott Hughesecho 'a	b	c' >foo
25*9a7741deSElliott Hughes$awk -F t '{print NF}' foo >foo1
26*9a7741deSElliott Hughesecho '3' >foo2
27*9a7741deSElliott Hughesdiff foo1 foo2 || echo 'bad: awk -F (tab)'
28*9a7741deSElliott Hughes
29*9a7741deSElliott Hughesecho 'atabbtabc' >foo
30*9a7741deSElliott Hughes$awk -F tab '{print NF}' foo >foo1
31*9a7741deSElliott Hughesecho '3' >foo2
32*9a7741deSElliott Hughesdiff foo1 foo2 || echo 'bad: awk -F tab'
33