forked from elixirscript/elixirscript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcase.spec.js
More file actions
32 lines (24 loc) · 722 Bytes
/
case.spec.js
File metadata and controls
32 lines (24 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import Core from "../lib/core";
const Patterns = Core.Patterns;
const SpecialForms = Core.SpecialForms;
const Tuple = Core.Tuple;
import Enum from "../lib/enum";
import chai from 'chai';
var expect = chai.expect;
describe('case', () => {
it('case', () => {
let clauses = [
Patterns.make_case(
[new Tuple(Symbol.for("selector"), Patterns.variable(), Patterns.variable())],
function(i, value){ return value; },
function(i){ return Kernel.is_integer(i); }
),
Patterns.make_case(
[Patterns.variable()],
function(value){ return value; }
)
];
let result = SpecialForms._case("thing", clauses);
expect(result).to.equal("thing");
});
});