File tree 1 file changed +36
-0
lines changed
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,42 @@ Rebol [
78
78
===end-group===
79
79
80
80
===start-group=== "module import"
81
+ --test-- "import"
82
+ ;@@ https://github.com/Oldes/Rebol-issues/issues/923
83
+ write %mymodule.reb {
84
+ Rebol [
85
+ type: 'module
86
+ name: 'mymodule
87
+ exports: [myfunc]
88
+ ]
89
+ print "mymodule imported"
90
+ myfunc: func [arg [string!]][reverse arg]
91
+ }
92
+ import 'mymodule
93
+ --assert "cba" = myfunc "abc"
94
+ import 'mymodule ;-- this works... the file isn't reloaded... and indeed the console doesn't print another "mymodule imported"
95
+ --assert "cba" = myfunc "abc"
96
+ import %mymodule.reb ;-- no crash
97
+ --assert "cba" = myfunc "abc"
98
+ delete %mymodule.reb
99
+
100
+ ;;; This test would fail as the module needs itself! It should be detected, but it isn't yet.
101
+ ;; write %mymodule2.reb {
102
+ ;; Rebol [
103
+ ;; type: 'module
104
+ ;; name: 'mymodule2
105
+ ;; exports: [myfunc2]
106
+ ;; needs: [%mymodule2.reb]
107
+ ;; ]
108
+ ;; print "mymodule2 imported"
109
+ ;; myfunc2: func [arg [string!]][reverse arg]
110
+ ;; }
111
+ ;; import 'mymodule2
112
+ ;; import 'mymodule2
113
+ ;; import %mymodule2.reb ;-- no crash
114
+ ;; --assert "cba" = myfunc2 "abc"
115
+ ;; delete %mymodule2.reb
116
+
81
117
--test-- "import/version"
82
118
;@@ https://github.com/Oldes/Rebol-issues/issues/1687
83
119
m: module [version: 1.0.0 name: 'Foo][a: 1 ]
You can’t perform that action at this time.
0 commit comments