Skip to content

Commit 9dcb3ad

Browse files
committed
import spec
1 parent d378e21 commit 9dcb3ad

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

spec/import_spec.moon

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
describe "import", ->
2+
it "should import from table", ->
3+
import sort, insert from table
4+
t = { 4,2,6 }
5+
insert t, 1
6+
sort t
7+
8+
assert.same t, {1,2,4,6}
9+
10+
it "should import from local", ->
11+
thing = { var: 10, hello: "world", func: => @var }
12+
import hello, \func from thing
13+
14+
assert.same hello, thing.hello
15+
assert.same func!, thing.var
16+
17+
it "should not call source multiple times", ->
18+
count = 0
19+
source = ->
20+
count += 1
21+
{ hello: "world", foo: "bar" }
22+
23+
import hello, foo from source!
24+
25+
assert.same count, 1
26+

0 commit comments

Comments
 (0)