From 44fec922a4e2aba07561dabbd40f5b92f0b287f8 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Thu, 31 Dec 2009 15:08:54 -0500 Subject: [PATCH] adding a filtered object comprehension test --- test/fixtures/execution/test_array_comprehension.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/fixtures/execution/test_array_comprehension.coffee b/test/fixtures/execution/test_array_comprehension.coffee index 5cb68506..eba50e30 100644 --- a/test/fixtures/execution/test_array_comprehension.coffee +++ b/test/fixtures/execution/test_array_comprehension.coffee @@ -1,12 +1,14 @@ -nums: n * n for n in [1, 2, 3] when n % 2 isnt 0 +nums: n * n for n in [1, 2, 3] when n % 2 isnt 0 results: n * 2 for n in nums -obj: {one: 1, two: 2, three: 3} +obj: {one: 1, two: 2, three: 3} names: key + '!' for value, key in obj +odds: key + '!' for value, key in obj when value % 2 isnt 0 # next: for n in [1, 2, 3] if n % 2 isnt 0 # print('hi') if false # n * n * 2 print(results.join(',') is '2,18') -print(names.join(' ') is "one! two! three!") \ No newline at end of file +print(names.join(' ') is "one! two! three!") +print(odds.join(' ') is "one! three!") \ No newline at end of file