mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 11:31:20 -05:00
added some execution test
This commit is contained in:
4
test/fixtures/execution/array_comprehension.cs
vendored
Normal file
4
test/fixtures/execution/array_comprehension.cs
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
nums: n * n for n in [1, 2, 3] if n % 2 aint 0.
|
||||
result: n * 2 for n in nums.
|
||||
|
||||
print(result.join(',') is '2,18')
|
||||
21
test/fixtures/execution/array_comprehension.js
vendored
Normal file
21
test/fixtures/execution/array_comprehension.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
(function(){
|
||||
var nums;
|
||||
var a = [1, 2, 3];
|
||||
var d = [];
|
||||
for (var b=0, c=a.length; b<c; b++) {
|
||||
var n = a[b];
|
||||
if (n % 2 !== 0) {
|
||||
nums = d.push(n * n);
|
||||
}
|
||||
}
|
||||
nums = d;
|
||||
var result;
|
||||
var e = nums;
|
||||
var h = [];
|
||||
for (var f=0, g=e.length; f<g; f++) {
|
||||
n = e[f];
|
||||
h[f] = n * 2;
|
||||
}
|
||||
result = h;
|
||||
print(result.join(',') === '2,18');
|
||||
})();
|
||||
6
test/fixtures/execution/assign_to_try_catch.cs
vendored
Normal file
6
test/fixtures/execution/assign_to_try_catch.cs
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
result: try
|
||||
nonexistent * missing
|
||||
catch error
|
||||
true.
|
||||
|
||||
print(result)
|
||||
9
test/fixtures/execution/assign_to_try_catch.js
vendored
Normal file
9
test/fixtures/execution/assign_to_try_catch.js
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
(function(){
|
||||
var result;
|
||||
try {
|
||||
result = nonexistent * missing;
|
||||
} catch (error) {
|
||||
result = true;
|
||||
}
|
||||
print(result);
|
||||
})();
|
||||
11
test/fixtures/execution/fancy_if_statement.cs
vendored
Normal file
11
test/fixtures/execution/fancy_if_statement.cs
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
a: b: d: true
|
||||
c: false
|
||||
|
||||
result: if a
|
||||
if b
|
||||
if c then false
|
||||
else
|
||||
if d
|
||||
true....
|
||||
|
||||
print(result)
|
||||
6
test/fixtures/execution/fancy_if_statement.js
vendored
Normal file
6
test/fixtures/execution/fancy_if_statement.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
(function(){
|
||||
var a = b = d = true;
|
||||
var c = false;
|
||||
var result = a ? b ? c ? false : d ? true : null : null : null;
|
||||
print(result);
|
||||
})();
|
||||
Reference in New Issue
Block a user