File: try.ftsh

package info (click to toggle)
cctools 3.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 5,704 kB
  • sloc: ansic: 49,398; cpp: 15,568; perl: 12,324; sh: 2,668; python: 1,422; makefile: 632; yacc: 433; lex: 152; xml: 109
file content (107 lines) | stat: -rw-r--r-- 1,329 bytes parent folder | download | duplicates (2)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

#
# A really trivial try block
#

try for 10 seconds
	echo "Not too hard."
end

#
# This try should always succeed
#

try
	try for 10 seconds
		sleep 1
	end
	echo "Try did not expire, as expected."
catch
	echo "Try expired incorrectly!"
	failure
end

#
# This try should always fail
#

try
	try for 1 second
		sleep 10
	end
	echo "Try should not have succeeded!."
catch
	echo "Try failed as expected."
end

#
# This try should succeed after several times through
#

try
	tm=6

	try for 10 times
		newtm=${tm} .sub. 1
		tm=${newtm}
		try for 3 seconds
			sleep ${tm}
		end
	end
	echo "Try eventually succeeded, as expected"
catch
	echo "Try failed unexpectedly."
	failure
end

#
# Test lots of variations on syntax
#

try 1 time 10 seconds
	echo "Testing"
end

try for 1 time 10 seconds
	echo "Testing"
end

try 1 time or 10 seconds
	echo "Testing"
end

try for 1 time or 10 seconds
	echo "Testing"
end

try 10 seconds 1 time
	echo "Testing"
end

try for 10 seconds 1 time
	echo "Testing"
end

try 10 seconds or 1 time
	echo "Testing"
end

try for 10 seconds or 1 time
	echo "Testing"
end

try for 10 seconds or 1 time
	echo "Testing"
end

try for 10 seconds or 1 time
	echo "Testing"
end

try 10 seconds or 1 time every 10 seconds
        echo "Testing"
end

try 1 time or 10 seconds every 10 seconds
        echo "Testing"
end