Inital Commit
[oweals/finalsclub.git] / node_modules / jade / support / coffee-script / test / test_break.coffee
1 # Test with break at the top level.
2 array = [1,2,3]
3 callWithLambda = (l) -> null
4 for i in array
5   result = callWithLambda(->)
6   if i == 2
7     puts "i = 2"
8   else
9     break
10
11 ok result is null
12
13
14 # Test with break *not* at the top level.
15 someFunc = (input) ->
16   takesLambda = (l) -> null
17   for i in [1,2]
18     result = takesLambda(->)
19     if input == 1
20       return 1
21     else
22       break
23
24   return 2
25
26 ok someFunc(1) is 1
27 ok someFunc(2) is 2
28