mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-18 13:49:59 +01:00
Split out the core and main modules.
- Implicitly import everything in core into every imported module. - Test cyclic imports.
This commit is contained in:
9
test/module/cyclic_import/a.wren
Normal file
9
test/module/cyclic_import/a.wren
Normal file
@ -0,0 +1,9 @@
|
||||
// nontest
|
||||
IO.print("start a")
|
||||
|
||||
var A = "a value"
|
||||
IO.print("a defined ", A)
|
||||
var B = "b".import_("B")
|
||||
IO.print("a imported ", B)
|
||||
|
||||
IO.print("end a")
|
||||
9
test/module/cyclic_import/b.wren
Normal file
9
test/module/cyclic_import/b.wren
Normal file
@ -0,0 +1,9 @@
|
||||
// nontest
|
||||
IO.print("start b")
|
||||
|
||||
var B = "b value"
|
||||
IO.print("b defined ", B)
|
||||
var A = "a".import_("A")
|
||||
IO.print("b imported ", A)
|
||||
|
||||
IO.print("end b")
|
||||
11
test/module/cyclic_import/cyclic_import.wren
Normal file
11
test/module/cyclic_import/cyclic_import.wren
Normal file
@ -0,0 +1,11 @@
|
||||
var A = "a".import_("A")
|
||||
|
||||
// Shared module should only run once:
|
||||
// expect: start a
|
||||
// expect: a defined a value
|
||||
// expect: start b
|
||||
// expect: b defined b value
|
||||
// expect: b imported a value
|
||||
// expect: end b
|
||||
// expect: a imported b value
|
||||
// expect: end a
|
||||
@ -0,0 +1,15 @@
|
||||
var Module = "module".import_("Module")
|
||||
// expect: Bool
|
||||
// expect: Class
|
||||
// expect: Fiber
|
||||
// expect: Fn
|
||||
// expect: List
|
||||
// expect: Map
|
||||
// expect: MapKeySequence
|
||||
// expect: MapValueSequence
|
||||
// expect: Null
|
||||
// expect: Num
|
||||
// expect: Object
|
||||
// expect: Range
|
||||
// expect: Sequence
|
||||
// expect: String
|
||||
17
test/module/implicitly_imports_core/module.wren
Normal file
17
test/module/implicitly_imports_core/module.wren
Normal file
@ -0,0 +1,17 @@
|
||||
// nontest
|
||||
var Module = "from module"
|
||||
|
||||
IO.print(Bool)
|
||||
IO.print(Class)
|
||||
IO.print(Fiber)
|
||||
IO.print(Fn)
|
||||
IO.print(List)
|
||||
IO.print(Map)
|
||||
IO.print(MapKeySequence)
|
||||
IO.print(MapValueSequence)
|
||||
IO.print(Null)
|
||||
IO.print(Num)
|
||||
IO.print(Object)
|
||||
IO.print(Range)
|
||||
IO.print(Sequence)
|
||||
IO.print(String)
|
||||
Reference in New Issue
Block a user