summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/binary/annotations-custom-sections.txt9
-rw-r--r--test/binary/user-section.txt9
-rw-r--r--test/parse/annotations.txt7
-rw-r--r--test/parse/custom-sections.txt5
-rw-r--r--test/roundtrip/custom-sections.txt13
5 files changed, 40 insertions, 3 deletions
diff --git a/test/binary/annotations-custom-sections.txt b/test/binary/annotations-custom-sections.txt
new file mode 100644
index 00000000..7e740e17
--- /dev/null
+++ b/test/binary/annotations-custom-sections.txt
@@ -0,0 +1,9 @@
+;;; TOOL: run-gen-wasm
+;;; ARGS: --enable-annotations
+magic
+version
+section("foo") { "hello" }
+(;; STDOUT ;;;
+(module
+ (@custom "foo" "hello"))
+;;; STDOUT ;;)
diff --git a/test/binary/user-section.txt b/test/binary/user-section.txt
index ee021d0a..e97a31c7 100644
--- a/test/binary/user-section.txt
+++ b/test/binary/user-section.txt
@@ -9,14 +9,23 @@ section("foo") { count[6] }
(;; STDERR ;;;
BeginModule(version: 1)
BeginCustomSection('foo', size: 5)
+ BeginGenericCustomSection(5)
+ OnGenericCustomSection(name: "foo", size: 1)
+ EndGenericCustomSection
EndCustomSection
BeginTypeSection(5)
OnTypeCount(1)
OnFuncType(index: 0, params: [], results: [i32])
EndTypeSection
BeginCustomSection('bar', size: 5)
+ BeginGenericCustomSection(5)
+ OnGenericCustomSection(name: "bar", size: 1)
+ EndGenericCustomSection
EndCustomSection
BeginCustomSection('foo', size: 5)
+ BeginGenericCustomSection(5)
+ OnGenericCustomSection(name: "foo", size: 1)
+ EndGenericCustomSection
EndCustomSection
EndModule
;;; STDERR ;;)
diff --git a/test/parse/annotations.txt b/test/parse/annotations.txt
index abac03b4..c8dc2826 100644
--- a/test/parse/annotations.txt
+++ b/test/parse/annotations.txt
@@ -4,6 +4,7 @@
(func (@name "some func") (result i32)
i32.const 42
return)
- (@custom section)
- (@custom (@nested section))
- (@custom (section) (@with "other") nested-subsections))
+ (@annot annotation (@nested section))
+ (@section section)
+ (@section (@nested section))
+ (@section (section) (@with "other") nested-subsections))
diff --git a/test/parse/custom-sections.txt b/test/parse/custom-sections.txt
new file mode 100644
index 00000000..4bb2cb46
--- /dev/null
+++ b/test/parse/custom-sections.txt
@@ -0,0 +1,5 @@
+;;; TOOL: wat2wasm
+;;; ARGS: --enable-annotations
+(module
+ (@custom "custom" "contents")
+ (@custom "custom2" (after code) "stuff"))
diff --git a/test/roundtrip/custom-sections.txt b/test/roundtrip/custom-sections.txt
new file mode 100644
index 00000000..b41b1acc
--- /dev/null
+++ b/test/roundtrip/custom-sections.txt
@@ -0,0 +1,13 @@
+;;; TOOL: run-roundtrip
+;;; ARGS: --enable-annotations --stdout
+(module
+ (@custom "stuff" (before import) "hello")
+ (import "a" "b" (func (result i32)))
+ (@custom "section" "nice"))
+(;; STDOUT ;;;
+(module
+ (type (;0;) (func (result i32)))
+ (import "a" "b" (func (;0;) (type 0)))
+ (@custom "stuff" "hello")
+ (@custom "section" "nice"))
+;;; STDOUT ;;)