summaryrefslogtreecommitdiffstats
path: root/contrib/awk/test/fnarydel.awk
blob: 8a1264cbed64a18e52888ca669cf0b250105362e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/local/bin/gawk -f
BEGIN {
  process()
}

function process(aa,a) {
  delete aa
}

BEGIN {
	for (i = 1; i < 10; i++)
		a[i] = i;

	print "first loop"
	for (i in a)
		print a[i]

	delete a

	print "second loop"
	for (i in a)
		print a[i]

	for (i = 1; i < 10; i++)
		a[i] = i;

	print "third loop"
	for (i in a)
		print a[i]

	print "call func"
	delit(a)

	print "fourth loop"
	for (i in a)
		print a[i]

	stressit()
}

function delit(arr)
{
	delete arr
}

function stressit(	array, i)
{
	delete array
	array[4] = 4
	array[5] = 5
	delete array[5]
	print "You should just see: 4 4"
	for (i in array)
		print i, array[i]
	delete array
	print "You should see nothing between this line"
	for (i in array)
		print i, array[i]
	print "And this one"
}
OpenPOWER on IntegriCloud