aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
authorEduardo Julian2021-08-29 14:57:15 -0400
committerEduardo Julian2021-08-29 14:57:15 -0400
commit1680d4d8bc4046ed4728413f1e7cfd77aa7e84b7 (patch)
tree7e79997206c0102e4cd63f34e4da2a4336df52f4 /stdlib/source/test
parentc5b61d2f46ac19bf511197f3a537c4be0f47df33 (diff)
Made labels (tags & slots) into a form of global binding.
Diffstat (limited to 'stdlib/source/test')
-rw-r--r--stdlib/source/test/lux/macro.lux4
-rw-r--r--stdlib/source/test/lux/meta.lux78
-rw-r--r--stdlib/source/test/lux/target/jvm.lux2
3 files changed, 35 insertions, 49 deletions
diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux
index 2e8c199b4..fa117e96b 100644
--- a/stdlib/source/test/lux/macro.lux
+++ b/stdlib/source/test/lux/macro.lux
@@ -79,8 +79,6 @@
(!global /.log_expansion!)
(!global /.log_full_expansion!)))
#.imports (list)
- #.tags (list)
- #.types (list)
#.module_annotations #.None
#.module_state #.Active}]
[current_module
@@ -91,8 +89,6 @@
(!global ..pow/4)
(!global ..repeated)))
#.imports (list)
- #.tags (list)
- #.types (list)
#.module_annotations #.None
#.module_state #.Active}])
#.scopes (list)
diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux
index 7d397e5d5..9e0175947 100644
--- a/stdlib/source/test/lux/meta.lux
+++ b/stdlib/source/test/lux/meta.lux
@@ -183,16 +183,12 @@
#.module_aliases (list)
#.definitions (list)
#.imports (list)
- #.tags (list)
- #.types (list)
#.module_annotations #.None
#.module_state #.Active}
expected_module {#.module_hash 0
#.module_aliases (list)
#.definitions (list)
#.imports (list imported_module_name)
- #.tags (list)
- #.types (list)
#.module_annotations #.None
#.module_state #.Active}
expected_modules (list [expected_current_module
@@ -384,8 +380,6 @@
#.module_aliases (list)
#.definitions current_globals
#.imports (list)
- #.tags (list)
- #.types (list)
#.module_annotations #.None
#.module_state #.Active}]
[expected_macro_module
@@ -393,8 +387,6 @@
#.module_aliases (list)
#.definitions macro_globals
#.imports (list)
- #.tags (list)
- #.types (list)
#.module_annotations #.None
#.module_state #.Active}])
#.scopes (list)
@@ -506,8 +498,6 @@
#.module_aliases (list)
#.definitions current_globals
#.imports (list)
- #.tags (list)
- #.types (list)
#.module_annotations #.None
#.module_state #.Active}]
[expected_macro_module
@@ -515,8 +505,6 @@
#.module_aliases (list)
#.definitions macro_globals
#.imports (list)
- #.tags (list)
- #.types (list)
#.module_annotations #.None
#.module_state #.Active}])
#.scopes (list)
@@ -655,19 +643,22 @@
(random.ascii/upper 1))
.let [random_tag (\ ! each (|>> [tag_module])
- (random.ascii/upper 1))]
- all_tags (|> random_tag
- (random.set name.hash 10)
- (\ ! each set.list))
- .let [tags_0 (list.first 5 all_tags)
- tags_1 (list.after 5 all_tags)
-
- type_0 (#.Primitive name_0 (list))
+ (random.ascii/upper 1))
+ random_labels (: (Random [Text (List Text)])
+ (do !
+ [head (random.ascii/lower 5)]
+ (|> (random.ascii/lower 5)
+ (random.only (|>> (text\= head) not))
+ (random.set text.hash 3)
+ (\ ! each set.list)
+ (random.and (in head)))))]
+ tags_0 random_labels
+ tags_1 (let [set/0 (set.of_list text.hash (#.Item tags_0))]
+ (random.only (|>> #.Item (list.any? (set.member? set/0))not)
+ random_labels))
+ .let [type_0 (#.Primitive name_0 (list))
type_1 (#.Primitive name_1 (list))
- entry_0 [name_0 [tags_0 false type_0]]
- entry_1 [name_1 [tags_1 true type_1]]
-
expected_lux
(: Lux
{#.info {#.target ""
@@ -681,24 +672,23 @@
#.module_aliases (list)
#.definitions (list)
#.imports (list tag_module)
- #.tags (list)
- #.types (list)
#.module_annotations #.None
#.module_state #.Active}]
[tag_module
{#.module_hash 0
#.module_aliases (list)
- #.definitions (list)
+ #.definitions (list& [name_0 (#.Type [false type_0 (#.Left tags_0)])]
+ [name_1 (#.Type [true type_1 (#.Right tags_1)])]
+ ($_ list\composite
+ (|> (#.Item tags_0)
+ list.enumeration
+ (list\each (function (_ [index short])
+ [(format "#" short) (#.Label [false type_0 (#.Item tags_0) index])])))
+ (|> (#.Item tags_1)
+ list.enumeration
+ (list\each (function (_ [index short])
+ [(format "#" short) (#.Slot [true type_1 (#.Item tags_1) index])])))))
#.imports (list)
- #.tags (list\composite (|> tags_0
- list.enumeration
- (list\each (function (_ [index [_ short]])
- [short [index tags_0 false type_0]])))
- (|> tags_1
- list.enumeration
- (list\each (function (_ [index [_ short]])
- [short [index tags_1 true type_1]]))))
- #.types (list entry_0 entry_1)
#.module_annotations #.None
#.module_state #.Active}])
#.scopes (list)
@@ -719,28 +709,29 @@
type.equivalence))]
(|> (/.tag_lists tag_module)
(/.result expected_lux)
- (try\each (\ equivalence = (list [tags_1 type_1])))
+ (try\each (\ equivalence = (list [(list\each (|>> [tag_module]) (#.Item tags_1))
+ type_1])))
(try.else false))))
(_.cover [/.tags_of]
(|> (/.tags_of [tag_module name_1])
(/.result expected_lux)
- (try\each (\ (maybe.equivalence (list.equivalence name.equivalence)) = (#.Some tags_1)))
+ (try\each (\ (maybe.equivalence (list.equivalence name.equivalence)) = (#.Some (list\each (|>> [tag_module]) (#.Item tags_1)))))
(try.else false)))
(_.cover [/.tag]
- (|> tags_1
+ (|> (#.Item tags_1)
list.enumeration
(list.every? (function (_ [expected_index tag])
- (|> tag
+ (|> [tag_module tag]
/.tag
(/.result expected_lux)
- (!expect (^multi (^ (#try.Success [actual_index actual_tags actual_type]))
+ (!expect (^multi (#try.Success [actual_index actual_tags actual_type])
(let [correct_index!
(n.= expected_index
actual_index)
correct_tags!
(\ (list.equivalence name.equivalence) =
- tags_1
+ (list\each (|>> [tag_module]) (#.Item tags_1))
actual_tags)
correct_type!
@@ -748,7 +739,8 @@
actual_type)]
(and correct_index!
correct_tags!
- correct_type!)))))))))
+ correct_type!))))
+ )))))
)))
(def: locals_related
@@ -807,8 +799,6 @@
#.module_aliases (list)
#.definitions globals
#.imports (list)
- #.tags (list)
- #.types (list)
#.module_annotations #.None
#.module_state #.Active}])
#.scopes scopes
diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux
index 9494096f2..6dd299f2c 100644
--- a/stdlib/source/test/lux/target/jvm.lux
+++ b/stdlib/source/test/lux/target/jvm.lux
@@ -1,6 +1,6 @@
(.module:
[library
- [lux (#- Type type primitive int)
+ [lux (#- Type Label type primitive int)
["." ffi (#+ import:)]
["@" target]
[abstract