summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2011-01-27 23:00:39 +0200
committerArnold D. Robbins <arnold@skeeve.com>2011-01-27 23:00:39 +0200
commited816b945b9725b26aa7f44fdab5bec0c48a8507 (patch)
tree874f7b292af74e7c76c0af4656cdf51547157e9b /test
parenta5f230f0ac5eb4f1d720ba743bc2538057cd8258 (diff)
downloadgawk-ed816b945b9725b26aa7f44fdab5bec0c48a8507.tar.gz
Add controlled array sorting in for loop. Needs documenting.
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog5
-rw-r--r--test/Makefile.am5
-rw-r--r--test/Makefile.in10
-rw-r--r--test/Maketests5
-rw-r--r--test/sortfor.awk8
-rw-r--r--test/sortfor.in289
-rw-r--r--test/sortfor.ok289
7 files changed, 609 insertions, 2 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 88c0f137..fb96b5ce 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jan 27 22:56:19 2011 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (sortfor): New test.
+ * sortfor.awk, sortfor.in, sortfor.ok: New files.
+
Thu Jan 27 22:03:22 2011 John Haque <j.eh@mchsi.com>
* xref.awk, profile2.ok: Fixed to be character set independent.
diff --git a/test/Makefile.am b/test/Makefile.am
index 0ac57bd7..27876090 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -617,6 +617,9 @@ EXTRA_DIST = \
sort1.ok \
sortempty.awk \
sortempty.ok \
+ sortfor.awk \
+ sortfor.in \
+ sortfor.ok \
space.ok \
splitarg4.awk \
splitarg4.in \
@@ -760,7 +763,7 @@ GAWK_EXT_TESTS = \
lintold manyfiles match1 match2 match3 mbstr1 nondec nondec2 patsplit \
posix profile1 profile2 printfbad1 printfbad2 \
procinfs rebuf regx8bit reint reint2 rsstart1 rsstart2 rsstart3 \
- rstest6 shadow splitarg4 strftime strtonum switch2
+ rstest6 shadow sortfor splitarg4 strftime strtonum switch2
EXTRA_TESTS = regtest inftest
diff --git a/test/Makefile.in b/test/Makefile.in
index 58d0e6f4..d035ef22 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -802,6 +802,9 @@ EXTRA_DIST = \
sort1.ok \
sortempty.awk \
sortempty.ok \
+ sortfor.awk \
+ sortfor.in \
+ sortfor.ok \
space.ok \
splitarg4.awk \
splitarg4.in \
@@ -944,7 +947,7 @@ GAWK_EXT_TESTS = \
lintold manyfiles match1 match2 match3 mbstr1 nondec nondec2 patsplit \
posix profile1 profile2 printfbad1 printfbad2 \
procinfs rebuf regx8bit reint reint2 rsstart1 rsstart2 rsstart3 \
- rstest6 shadow splitarg4 strftime strtonum switch2
+ rstest6 shadow sortfor splitarg4 strftime strtonum switch2
EXTRA_TESTS = regtest inftest
INET_TESTS = inetechu inetecht inetdayu inetdayt
@@ -2696,6 +2699,11 @@ shadow:
@AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+sortfor:
+ @echo sortfor
+ @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
splitarg4:
@echo splitarg4
@AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index dc69aaf2..c0222139 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1030,6 +1030,11 @@ shadow:
@AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+sortfor:
+ @echo sortfor
+ @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
splitarg4:
@echo splitarg4
@AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/sortfor.awk b/test/sortfor.awk
new file mode 100644
index 00000000..2b601c80
--- /dev/null
+++ b/test/sortfor.awk
@@ -0,0 +1,8 @@
+BEGIN {
+ PROCINFO["sorted_for_loop"] = 1
+}
+{ a[$0]++ }
+END {
+ for (i in a)
+ print i
+}
diff --git a/test/sortfor.in b/test/sortfor.in
new file mode 100644
index 00000000..f0e4d510
--- /dev/null
+++ b/test/sortfor.in
@@ -0,0 +1,289 @@
+fsspcoln
+ofmtfidl
+strtonum
+strftime
+uninitialized
+manyfiles
+delarpm2
+wideidx
+parseme
+paramres
+fldchgnf
+subslash
+intprec
+asorti
+mbprintf1
+mbprintf2
+synerr1
+mbprintf3
+synerr2
+arynasty
+swaplns
+asort
+patsplit
+delarprm
+gensub
+litoct
+opasnidx
+clsflnam
+fnarydel
+uparrfs
+argarray
+numindex
+devfd1
+devfd2
+delfunc
+localenl
+noeffect
+fstabplus
+hsprint
+fsfwfs
+tradanch
+fldchg
+printfbad1
+unterm
+printfbad2
+fmttest
+minusstr
+posix
+arrymem1
+concat1
+reint2
+gnuops2
+concat2
+fsrs
+gnuops3
+resplit
+concat3
+fnparydl
+concat4
+uninit2
+rs
+fnarray
+uninit3
+paramdup
+mmap8k
+fieldwdth
+devfd
+uninit4
+poundbang
+uninit5
+nondec2
+switch2
+numsubstr
+profile1
+regx8bit
+profile2
+getline
+membug1
+lint
+zeroflag
+fnasgnm
+widesub2
+widesub3
+reindops
+exitval1
+binmode1
+widesub4
+exitval2
+intest
+back89
+substr
+arynocls
+opasnslf
+ofmtbig
+mbfw1
+zeroe0
+arrayparm
+nasty
+aasort
+sclifin
+nofmtch
+leadnl
+getlnhd
+nofile
+fflush
+printf0
+reparse
+printf1
+prtoeval
+funsmnam
+tweakfld
+sclforin
+wjposer1
+clobber
+iobug1
+fnamedat
+leaddig
+double1
+double2
+strcat1
+prdupval
+messages
+space
+nlfldsep
+posix2008sub
+wideidx2
+nfldstr
+zero2
+rebt8b1
+onlynl
+rebt8b2
+fwtest
+anchgsub
+beginfile1
+fnmisc
+getlndir
+rand
+fwtest2
+nested
+childin
+mtchi18n
+gsubtest
+manglprm
+intformat
+longwrds
+splitarr
+arysubnm
+rsstart1
+procinfs
+argtest
+regeq
+rsstart2
+rsstart3
+sort1
+fmtspcl
+reint
+rsnulbig
+closebad
+strftlng
+parse1
+ofmt
+ignrcas2
+splitarg4
+range1
+noloop1
+longsub
+igncdym
+widesub
+noloop2
+aadelete1
+subi18n
+gsubtst2
+aadelete2
+gsubtst3
+gsubtst4
+convfmt
+gsubtst5
+nors
+arrayref
+gsubtst6
+parsefld
+indirectcall
+asgext
+shadow
+octsub
+nfneg
+backgsub
+math
+getlnbuf
+addcomma
+mbstr1
+subsepnm
+nulrsend
+rsnulbig2
+sprintfc
+redfilnm
+igncfs
+splitwht
+fcall_exit
+fordel
+subamp
+paramtyp
+nlinstr
+eofsplit
+fsbs
+dumpvars
+nlstrina
+datanonl
+fcall_exit2
+icasers
+badargs
+nfset
+gsubasgn
+lc_num1
+aasorti
+pipeio1
+pipeio2
+sortempty
+inputred
+backw
+rswhite
+awkpath
+forsimp
+match1
+match2
+splitvar
+match3
+aryprm1
+aryprm2
+aryprm3
+getline2
+aarray1
+aryprm4
+fnarray2
+getline3
+ignrcase
+aryprm5
+pcntplus
+aryprm6
+aryprm7
+ofmts
+aryprm8
+dynlj
+prec
+prmreuse
+gensub2
+splitdef
+prt1eval
+lintold
+scalar
+fnaryscl
+nondec
+compare2
+icasefs
+rstest1
+getnr2tb
+rstest2
+arryref2
+rstest3
+arryref3
+gnureops
+rstest4
+arryref4
+funstack
+splitargv
+rstest5
+arryref5
+rstest6
+clos1way
+pid
+rsnul1nl
+nasty2
+noparms
+defref
+rebuf
+strtod
+prmarscl
+arrayprm2
+arrayprm3
+getnr2tm
+forref
+funsemnl
+hex
+fpat1
+strnum1
+negexp
+compare
+funlen
+nonl
diff --git a/test/sortfor.ok b/test/sortfor.ok
new file mode 100644
index 00000000..3da24591
--- /dev/null
+++ b/test/sortfor.ok
@@ -0,0 +1,289 @@
+aadelete1
+aadelete2
+aarray1
+aasort
+aasorti
+addcomma
+anchgsub
+argarray
+argtest
+arrayparm
+arrayprm2
+arrayprm3
+arrayref
+arrymem1
+arryref2
+arryref3
+arryref4
+arryref5
+arynasty
+arynocls
+aryprm1
+aryprm2
+aryprm3
+aryprm4
+aryprm5
+aryprm6
+aryprm7
+aryprm8
+arysubnm
+asgext
+asort
+asorti
+awkpath
+back89
+backgsub
+backw
+badargs
+beginfile1
+binmode1
+childin
+clobber
+clos1way
+closebad
+clsflnam
+compare
+compare2
+concat1
+concat2
+concat3
+concat4
+convfmt
+datanonl
+defref
+delarpm2
+delarprm
+delfunc
+devfd
+devfd1
+devfd2
+double1
+double2
+dumpvars
+dynlj
+eofsplit
+exitval1
+exitval2
+fcall_exit
+fcall_exit2
+fflush
+fieldwdth
+fldchg
+fldchgnf
+fmtspcl
+fmttest
+fnamedat
+fnarray
+fnarray2
+fnarydel
+fnaryscl
+fnasgnm
+fnmisc
+fnparydl
+fordel
+forref
+forsimp
+fpat1
+fsbs
+fsfwfs
+fsrs
+fsspcoln
+fstabplus
+funlen
+funsemnl
+funsmnam
+funstack
+fwtest
+fwtest2
+gensub
+gensub2
+getline
+getline2
+getline3
+getlnbuf
+getlndir
+getlnhd
+getnr2tb
+getnr2tm
+gnuops2
+gnuops3
+gnureops
+gsubasgn
+gsubtest
+gsubtst2
+gsubtst3
+gsubtst4
+gsubtst5
+gsubtst6
+hex
+hsprint
+icasefs
+icasers
+igncdym
+igncfs
+ignrcas2
+ignrcase
+indirectcall
+inputred
+intest
+intformat
+intprec
+iobug1
+lc_num1
+leaddig
+leadnl
+lint
+lintold
+litoct
+localenl
+longsub
+longwrds
+manglprm
+manyfiles
+match1
+match2
+match3
+math
+mbfw1
+mbprintf1
+mbprintf2
+mbprintf3
+mbstr1
+membug1
+messages
+minusstr
+mmap8k
+mtchi18n
+nasty
+nasty2
+negexp
+nested
+nfldstr
+nfneg
+nfset
+nlfldsep
+nlinstr
+nlstrina
+noeffect
+nofile
+nofmtch
+noloop1
+noloop2
+nondec
+nondec2
+nonl
+noparms
+nors
+nulrsend
+numindex
+numsubstr
+octsub
+ofmt
+ofmtbig
+ofmtfidl
+ofmts
+onlynl
+opasnidx
+opasnslf
+paramdup
+paramres
+paramtyp
+parse1
+parsefld
+parseme
+patsplit
+pcntplus
+pid
+pipeio1
+pipeio2
+posix
+posix2008sub
+poundbang
+prdupval
+prec
+printf0
+printf1
+printfbad1
+printfbad2
+prmarscl
+prmreuse
+procinfs
+profile1
+profile2
+prt1eval
+prtoeval
+rand
+range1
+rebt8b1
+rebt8b2
+rebuf
+redfilnm
+regeq
+regx8bit
+reindops
+reint
+reint2
+reparse
+resplit
+rs
+rsnul1nl
+rsnulbig
+rsnulbig2
+rsstart1
+rsstart2
+rsstart3
+rstest1
+rstest2
+rstest3
+rstest4
+rstest5
+rstest6
+rswhite
+scalar
+sclforin
+sclifin
+shadow
+sort1
+sortempty
+space
+splitarg4
+splitargv
+splitarr
+splitdef
+splitvar
+splitwht
+sprintfc
+strcat1
+strftime
+strftlng
+strnum1
+strtod
+strtonum
+subamp
+subi18n
+subsepnm
+subslash
+substr
+swaplns
+switch2
+synerr1
+synerr2
+tradanch
+tweakfld
+uninit2
+uninit3
+uninit4
+uninit5
+uninitialized
+unterm
+uparrfs
+wideidx
+wideidx2
+widesub
+widesub2
+widesub3
+widesub4
+wjposer1
+zero2
+zeroe0
+zeroflag