aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs/test/loops_spec.yue
blob: a115581e524e1b9eb62724c2dd9c52d917c4e670 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
describe "loops", ->
	it "should continue", ->
		input = {1,2,3,4,5,6}
		output = for x in *input
			continue if x % 2 == 1
			x

		assert.same { 2,4,6 }, output

	it "continue in repeat", ->
		output = {}
		a = 0
		repeat
			a += 1
			if a == 3
				continue
			if a == 5
				break
			output[] = a
		until a == 8

		assert.same { 1,2,4 }, output