[483] | 1 | dojo.provide("dojox.lang.tests.lambda"); |
---|
| 2 | |
---|
| 3 | dojo.require("dojox.lang.functional"); |
---|
| 4 | dojo.require("dojox.lang.functional.sequence"); |
---|
| 5 | |
---|
| 6 | (function(){ |
---|
| 7 | var df = dojox.lang.functional; |
---|
| 8 | tests.register("dojox.lang.tests.lambda", [ |
---|
| 9 | function testLambda1(t){ t.assertEqual(df.repeat(3, "3*", 1), [1, 3, 9]); }, |
---|
| 10 | function testLambda2(t){ t.assertEqual(df.repeat(3, "*3", 1), [1, 3, 9]); }, |
---|
| 11 | function testLambda3(t){ t.assertEqual(df.repeat(3, "_*3", 1), [1, 3, 9]); }, |
---|
| 12 | function testLambda4(t){ t.assertEqual(df.repeat(3, "3*_", 1), [1, 3, 9]); }, |
---|
| 13 | function testLambda5(t){ t.assertEqual(df.repeat(3, "n->n*3", 1), [1, 3, 9]); }, |
---|
| 14 | function testLambda6(t){ t.assertEqual(df.repeat(3, "n*3", 1), [1, 3, 9]); }, |
---|
| 15 | function testLambda7(t){ t.assertEqual(df.repeat(3, "3*m", 1), [1, 3, 9]); }, |
---|
| 16 | function testLambda8(t){ t.assertEqual(df.repeat(3, "->1", 1), [1, 1, 1]); }, |
---|
| 17 | function testLambda9(t){ t.assertEqual(df.repeat(3, function(n){ return n * 3; }, 1), [1, 3, 9]); }, |
---|
| 18 | function testLambda10(t){ t.assertEqual(df.repeat(3, ["_-1", ["*3"]], 1), [1, 2, 5]); } |
---|
| 19 | ]); |
---|
| 20 | })(); |
---|