summaryrefslogtreecommitdiffstats
path: root/third_party/rust/wast/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /third_party/rust/wast/tests
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/wast/tests')
-rw-r--r--third_party/rust/wast/tests/annotations.rs200
-rw-r--r--third_party/rust/wast/tests/comments.rs76
-rw-r--r--third_party/rust/wast/tests/parse-fail.rs98
-rw-r--r--third_party/rust/wast/tests/parse-fail/bad-index.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/bad-index.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/bad-name.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/bad-name.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/bad-name2.wat2
-rw-r--r--third_party/rust/wast/tests/parse-fail/bad-name2.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/bad-name3.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/bad-name3.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/block1.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/block1.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/block2.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/block2.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/block3.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/block3.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment0.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment0.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment1.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment1.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment2.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment2.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment3.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment3.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment4.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment4.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment5.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment5.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment6.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment6.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment7.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment7.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment8.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-block-comment8.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment0.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment0.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment1.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment1.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment2.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment2.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment3.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment3.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment4.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment4.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment5.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment5.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment6.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment6.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment7.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment7.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment8.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-line-comment8.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string0.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string0.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string1.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string1.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string2.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string2.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string3.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string3.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string4.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string4.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string5.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string5.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string6.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string6.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string7.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string7.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string8.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/confusing-string8.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/inline1.wat4
-rw-r--r--third_party/rust/wast/tests/parse-fail/inline1.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/newline-in-string.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/newline-in-string.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/string1.wat2
-rw-r--r--third_party/rust/wast/tests/parse-fail/string1.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/string10.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/string10.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/string11.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/string11.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/string12.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/string12.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/string13.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/string13.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/string14.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/string14.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/string15.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/string15.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/string16.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/string16.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/string2.wat2
-rw-r--r--third_party/rust/wast/tests/parse-fail/string2.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/string3.wat3
-rw-r--r--third_party/rust/wast/tests/parse-fail/string3.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/string4.wat2
-rw-r--r--third_party/rust/wast/tests/parse-fail/string4.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/string5.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/string5.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/string6.watbin0 -> 4 bytes
-rw-r--r--third_party/rust/wast/tests/parse-fail/string6.wat.errbin0 -> 109 bytes
-rw-r--r--third_party/rust/wast/tests/parse-fail/string7.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/string7.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/string8.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/string8.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/string9.wat1
-rw-r--r--third_party/rust/wast/tests/parse-fail/string9.wat.err5
-rw-r--r--third_party/rust/wast/tests/parse-fail/unbalanced.wat3
-rw-r--r--third_party/rust/wast/tests/parse-fail/unbalanced.wat.err5
-rw-r--r--third_party/rust/wast/tests/recursive.rs8
110 files changed, 705 insertions, 0 deletions
diff --git a/third_party/rust/wast/tests/annotations.rs b/third_party/rust/wast/tests/annotations.rs
new file mode 100644
index 0000000000..706a392cc1
--- /dev/null
+++ b/third_party/rust/wast/tests/annotations.rs
@@ -0,0 +1,200 @@
+use wasmparser::*;
+
+#[test]
+fn name_annotations() -> anyhow::Result<()> {
+ assert_module_name("foo", r#"(module $foo)"#)?;
+ assert_module_name("foo", r#"(module (@name "foo"))"#)?;
+ assert_module_name("foo", r#"(module $bar (@name "foo"))"#)?;
+ assert_module_name("foo bar", r#"(module $bar (@name "foo bar"))"#)?;
+ Ok(())
+}
+
+fn assert_module_name(expected_name: &str, wat: &str) -> anyhow::Result<()> {
+ let wasm = wat::parse_str(wat)?;
+ let mut found = false;
+ for s in get_name_section(&wasm)? {
+ match s? {
+ Name::Module { name, .. } => {
+ assert_eq!(name, expected_name);
+ found = true;
+ }
+ _ => {}
+ }
+ }
+ assert!(found);
+ Ok(())
+}
+
+#[test]
+fn func_annotations() -> anyhow::Result<()> {
+ assert_func_name("foo", r#"(module (func $foo))"#)?;
+ assert_func_name("foo", r#"(module (func (@name "foo")))"#)?;
+ assert_func_name("foo", r#"(module (func $bar (@name "foo")))"#)?;
+ assert_func_name("foo bar", r#"(module (func $bar (@name "foo bar")))"#)?;
+ Ok(())
+}
+
+fn assert_func_name(name: &str, wat: &str) -> anyhow::Result<()> {
+ let wasm = wat::parse_str(wat)?;
+ let mut found = false;
+ for s in get_name_section(&wasm)? {
+ match s? {
+ Name::Function(n) => {
+ let naming = n.into_iter().next().unwrap()?;
+ assert_eq!(naming.index, 0);
+ assert_eq!(naming.name, name);
+ found = true;
+ }
+ _ => {}
+ }
+ }
+ assert!(found);
+ Ok(())
+}
+
+#[test]
+fn local_annotations() -> anyhow::Result<()> {
+ assert_local_name("foo", r#"(module (func (param $foo i32)))"#)?;
+ assert_local_name("foo", r#"(module (func (local $foo i32)))"#)?;
+ assert_local_name("foo", r#"(module (func (param (@name "foo") i32)))"#)?;
+ assert_local_name("foo", r#"(module (func (local (@name "foo") i32)))"#)?;
+ assert_local_name("foo", r#"(module (func (param $bar (@name "foo") i32)))"#)?;
+ assert_local_name("foo", r#"(module (func (local $bar (@name "foo") i32)))"#)?;
+ assert_local_name(
+ "foo bar",
+ r#"(module (func (param $bar (@name "foo bar") i32)))"#,
+ )?;
+ assert_local_name(
+ "foo bar",
+ r#"(module (func (local $bar (@name "foo bar") i32)))"#,
+ )?;
+ Ok(())
+}
+
+fn assert_local_name(name: &str, wat: &str) -> anyhow::Result<()> {
+ let wasm = wat::parse_str(wat)?;
+ let mut found = false;
+ for s in get_name_section(&wasm)? {
+ match s? {
+ Name::Local(n) => {
+ let naming = n
+ .into_iter()
+ .next()
+ .unwrap()?
+ .names
+ .into_iter()
+ .next()
+ .unwrap()?;
+ assert_eq!(naming.index, 0);
+ assert_eq!(naming.name, name);
+ found = true;
+ }
+ _ => {}
+ }
+ }
+ assert!(found);
+ Ok(())
+}
+
+fn get_name_section(wasm: &[u8]) -> anyhow::Result<NameSectionReader<'_>> {
+ for payload in Parser::new(0).parse_all(&wasm) {
+ if let Payload::CustomSection(c) = payload? {
+ if c.name() == "name" {
+ return Ok(NameSectionReader::new(c.data(), c.data_offset()));
+ }
+ }
+ }
+ panic!("no name section found");
+}
+
+#[test]
+fn custom_section_order() -> anyhow::Result<()> {
+ let bytes = wat::parse_str(
+ r#"
+ (module
+ (@custom "A" "aaa")
+ (type (func))
+ (@custom "B" (after func) "bbb")
+ (@custom "C" (before func) "ccc")
+ (@custom "D" (after last) "ddd")
+ (table 10 funcref)
+ (func (type 0))
+ (@custom "E" (after import) "eee")
+ (@custom "F" (before type) "fff")
+ (@custom "G" (after data) "ggg")
+ (@custom "H" (after code) "hhh")
+ (@custom "I" (after func) "iii")
+ (@custom "J" (before func) "jjj")
+ (@custom "K" (before first) "kkk")
+ )
+ "#,
+ )?;
+ macro_rules! assert_matches {
+ ($a:expr, $b:pat $(if $cond:expr)? $(,)?) => {
+ match &$a {
+ $b $(if $cond)? => {}
+ a => panic!("`{:?}` doesn't match `{}`", a, stringify!($b)),
+ }
+ };
+ }
+ let wasm = Parser::new(0)
+ .parse_all(&bytes)
+ .collect::<Result<Vec<_>>>()?;
+ assert_matches!(wasm[0], Payload::Version { .. });
+ assert_matches!(
+ wasm[1],
+ Payload::CustomSection(c) if c.name() == "K"
+ );
+ assert_matches!(
+ wasm[2],
+ Payload::CustomSection(c) if c.name() == "F"
+ );
+ assert_matches!(wasm[3], Payload::TypeSection(_));
+ assert_matches!(
+ wasm[4],
+ Payload::CustomSection(c) if c.name() == "E"
+ );
+ assert_matches!(
+ wasm[5],
+ Payload::CustomSection(c) if c.name() == "C"
+ );
+ assert_matches!(
+ wasm[6],
+ Payload::CustomSection(c) if c.name() == "J"
+ );
+ assert_matches!(wasm[7], Payload::FunctionSection(_));
+ assert_matches!(
+ wasm[8],
+ Payload::CustomSection(c) if c.name() == "B"
+ );
+ assert_matches!(
+ wasm[9],
+ Payload::CustomSection(c) if c.name() == "I"
+ );
+ assert_matches!(wasm[10], Payload::TableSection(_));
+ assert_matches!(wasm[11], Payload::CodeSectionStart { .. });
+ assert_matches!(wasm[12], Payload::CodeSectionEntry { .. });
+ assert_matches!(
+ wasm[13],
+ Payload::CustomSection(c) if c.name() == "H"
+ );
+ assert_matches!(
+ wasm[14],
+ Payload::CustomSection(c) if c.name() == "G"
+ );
+ assert_matches!(
+ wasm[15],
+ Payload::CustomSection(c) if c.name() == "A"
+ );
+ assert_matches!(
+ wasm[16],
+ Payload::CustomSection(c) if c.name() == "D"
+ );
+
+ match &wasm[17] {
+ Payload::End(x) if *x == bytes.len() => {}
+ p => panic!("`{:?}` doesn't match expected length of {}", p, bytes.len()),
+ }
+
+ Ok(())
+}
diff --git a/third_party/rust/wast/tests/comments.rs b/third_party/rust/wast/tests/comments.rs
new file mode 100644
index 0000000000..97252650be
--- /dev/null
+++ b/third_party/rust/wast/tests/comments.rs
@@ -0,0 +1,76 @@
+use wast::parser::{self, Parse, ParseBuffer, Parser, Result};
+
+pub struct Comments<'a> {
+ comments: Vec<&'a str>,
+}
+
+impl<'a> Parse<'a> for Comments<'a> {
+ fn parse(parser: Parser<'a>) -> Result<Comments<'a>> {
+ let comments = parser.step(|mut cursor| {
+ let mut comments = Vec::new();
+ loop {
+ let (comment, c) = match cursor.comment() {
+ Some(pair) => pair,
+ None => break,
+ };
+ cursor = c;
+ comments.push(if comment.starts_with(";;") {
+ &comment[2..]
+ } else {
+ &comment[2..comment.len() - 2]
+ });
+ }
+ Ok((comments, cursor))
+ })?;
+ Ok(Comments { comments })
+ }
+}
+
+pub struct Documented<'a, T> {
+ comments: Comments<'a>,
+ item: T,
+}
+
+impl<'a, T: Parse<'a>> Parse<'a> for Documented<'a, T> {
+ fn parse(parser: Parser<'a>) -> Result<Self> {
+ let comments = parser.parse()?;
+ let item = parser.parens(T::parse)?;
+ Ok(Documented { comments, item })
+ }
+}
+
+#[test]
+fn parse_comments() -> anyhow::Result<()> {
+ let buf = ParseBuffer::new(
+ r#"
+;; hello
+(; again ;)
+(module)
+ "#,
+ )?;
+
+ let d: Documented<wast::core::Module> = parser::parse(&buf)?;
+ assert_eq!(d.comments.comments, vec![" hello", " again "]);
+ drop(d.item);
+
+ let buf = ParseBuffer::new(
+ r#"
+;; this
+(; is
+on
+multiple;)
+
+
+;; lines
+(func)
+ "#,
+ )?;
+
+ let d: Documented<wast::core::Func> = parser::parse(&buf)?;
+ assert_eq!(
+ d.comments.comments,
+ vec![" this", " is\non\nmultiple", " lines"]
+ );
+ drop(d.item);
+ Ok(())
+}
diff --git a/third_party/rust/wast/tests/parse-fail.rs b/third_party/rust/wast/tests/parse-fail.rs
new file mode 100644
index 0000000000..3ae1817a4a
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail.rs
@@ -0,0 +1,98 @@
+//! A test suite to parse everything in `parse-fail` and assert that it matches
+//! the `*.err` file it generates.
+//!
+//! Use `BLESS=1` in the environment to auto-update `*.err` files. Be sure to
+//! look at the diff!
+
+use rayon::prelude::*;
+use std::env;
+use std::path::{Path, PathBuf};
+
+fn main() {
+ let mut tests = Vec::new();
+ find_tests("tests/parse-fail".as_ref(), &mut tests);
+ let filter = std::env::args().nth(1);
+
+ let bless = env::var("BLESS").is_ok();
+ let tests = tests
+ .iter()
+ .filter(|test| {
+ if let Some(filter) = &filter {
+ if let Some(s) = test.file_name().and_then(|s| s.to_str()) {
+ if !s.contains(filter) {
+ return false;
+ }
+ }
+ }
+ true
+ })
+ .collect::<Vec<_>>();
+
+ println!("running {} tests\n", tests.len());
+
+ let errors = tests
+ .par_iter()
+ .filter_map(|test| run_test(test, bless).err())
+ .collect::<Vec<_>>();
+
+ if !errors.is_empty() {
+ for msg in errors.iter() {
+ eprintln!("{}", msg);
+ }
+
+ panic!("{} tests failed", errors.len())
+ }
+
+ println!("test result: ok. {} passed\n", tests.len());
+}
+
+fn run_test(test: &Path, bless: bool) -> anyhow::Result<()> {
+ let err = match wat::parse_file(test) {
+ Ok(_) => anyhow::bail!("{} parsed successfully", test.display()),
+ Err(e) => e.to_string() + "\n",
+ };
+ let assert = test.with_extension("wat.err");
+ if bless {
+ std::fs::write(assert, err.to_string())?;
+ return Ok(());
+ }
+
+ // Ignore CRLF line ending and force always `\n`
+ let assert = std::fs::read_to_string(assert)
+ .unwrap_or(String::new())
+ .replace("\r\n", "\n");
+
+ // Compare normalize verisons which handles weirdness like path differences
+ if normalize(&assert) == normalize(&err) {
+ return Ok(());
+ }
+
+ anyhow::bail!(
+ "errors did not match:\n\nexpected:\n\t{}\nactual:\n\t{}\n",
+ tab(&assert),
+ tab(&err),
+ );
+
+ fn normalize(s: &str) -> String {
+ s.replace("\\", "/")
+ }
+
+ fn tab(s: &str) -> String {
+ s.replace("\n", "\n\t")
+ }
+}
+
+fn find_tests(path: &Path, tests: &mut Vec<PathBuf>) {
+ for f in path.read_dir().unwrap() {
+ let f = f.unwrap();
+ if f.file_type().unwrap().is_dir() {
+ find_tests(&f.path(), tests);
+ continue;
+ }
+ match f.path().extension().and_then(|s| s.to_str()) {
+ Some("wat") => {}
+ _ => continue,
+ }
+ tests.push(f.path());
+ }
+}
diff --git a/third_party/rust/wast/tests/parse-fail/bad-index.wat b/third_party/rust/wast/tests/parse-fail/bad-index.wat
new file mode 100644
index 0000000000..34262539a5
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/bad-index.wat
@@ -0,0 +1 @@
+(func br_on_null $s)
diff --git a/third_party/rust/wast/tests/parse-fail/bad-index.wat.err b/third_party/rust/wast/tests/parse-fail/bad-index.wat.err
new file mode 100644
index 0000000000..f380bddec1
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/bad-index.wat.err
@@ -0,0 +1,5 @@
+unknown label: failed to find name `$s`
+ --> tests/parse-fail/bad-index.wat:1:18
+ |
+ 1 | (func br_on_null $s)
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/bad-name.wat b/third_party/rust/wast/tests/parse-fail/bad-name.wat
new file mode 100644
index 0000000000..ce74a7d1cf
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/bad-name.wat
@@ -0,0 +1 @@
+(module (@name))
diff --git a/third_party/rust/wast/tests/parse-fail/bad-name.wat.err b/third_party/rust/wast/tests/parse-fail/bad-name.wat.err
new file mode 100644
index 0000000000..f20e2039b1
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/bad-name.wat.err
@@ -0,0 +1,5 @@
+expected a string
+ --> tests/parse-fail/bad-name.wat:1:15
+ |
+ 1 | (module (@name))
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/bad-name2.wat b/third_party/rust/wast/tests/parse-fail/bad-name2.wat
new file mode 100644
index 0000000000..7786f25ac6
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/bad-name2.wat
@@ -0,0 +1,2 @@
+(module (@name 2))
+
diff --git a/third_party/rust/wast/tests/parse-fail/bad-name2.wat.err b/third_party/rust/wast/tests/parse-fail/bad-name2.wat.err
new file mode 100644
index 0000000000..f937e98bfd
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/bad-name2.wat.err
@@ -0,0 +1,5 @@
+expected a string
+ --> tests/parse-fail/bad-name2.wat:1:16
+ |
+ 1 | (module (@name 2))
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/bad-name3.wat b/third_party/rust/wast/tests/parse-fail/bad-name3.wat
new file mode 100644
index 0000000000..02c8c5de04
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/bad-name3.wat
@@ -0,0 +1 @@
+(module (func (@name 2)))
diff --git a/third_party/rust/wast/tests/parse-fail/bad-name3.wat.err b/third_party/rust/wast/tests/parse-fail/bad-name3.wat.err
new file mode 100644
index 0000000000..43c57e7591
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/bad-name3.wat.err
@@ -0,0 +1,5 @@
+expected a string
+ --> tests/parse-fail/bad-name3.wat:1:22
+ |
+ 1 | (module (func (@name 2)))
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/block1.wat b/third_party/rust/wast/tests/parse-fail/block1.wat
new file mode 100644
index 0000000000..2c1d238e10
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/block1.wat
@@ -0,0 +1 @@
+(;
diff --git a/third_party/rust/wast/tests/parse-fail/block1.wat.err b/third_party/rust/wast/tests/parse-fail/block1.wat.err
new file mode 100644
index 0000000000..8544f334ac
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/block1.wat.err
@@ -0,0 +1,5 @@
+unterminated block comment
+ --> tests/parse-fail/block1.wat:1:1
+ |
+ 1 | (;
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/block2.wat b/third_party/rust/wast/tests/parse-fail/block2.wat
new file mode 100644
index 0000000000..5bfa511a19
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/block2.wat
@@ -0,0 +1 @@
+(; (;;)
diff --git a/third_party/rust/wast/tests/parse-fail/block2.wat.err b/third_party/rust/wast/tests/parse-fail/block2.wat.err
new file mode 100644
index 0000000000..fdf1ce27a2
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/block2.wat.err
@@ -0,0 +1,5 @@
+unterminated block comment
+ --> tests/parse-fail/block2.wat:1:1
+ |
+ 1 | (; (;;)
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/block3.wat b/third_party/rust/wast/tests/parse-fail/block3.wat
new file mode 100644
index 0000000000..beab65b9a3
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/block3.wat
@@ -0,0 +1 @@
+(; ;
diff --git a/third_party/rust/wast/tests/parse-fail/block3.wat.err b/third_party/rust/wast/tests/parse-fail/block3.wat.err
new file mode 100644
index 0000000000..d12a534110
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/block3.wat.err
@@ -0,0 +1,5 @@
+unterminated block comment
+ --> tests/parse-fail/block3.wat:1:1
+ |
+ 1 | (; ;
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment0.wat b/third_party/rust/wast/tests/parse-fail/confusing-block-comment0.wat
new file mode 100644
index 0000000000..d336f4ce97
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment0.wat
@@ -0,0 +1 @@
+(module) (; ‪ ;)
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment0.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-block-comment0.wat.err
new file mode 100644
index 0000000000..964cb84eb2
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment0.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{202a}'
+ --> tests/parse-fail/confusing-block-comment0.wat:1:13
+ |
+ 1 | (module) (; ;)
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment1.wat b/third_party/rust/wast/tests/parse-fail/confusing-block-comment1.wat
new file mode 100644
index 0000000000..29d83f46da
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment1.wat
@@ -0,0 +1 @@
+(module) (; ‫ ;)
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment1.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-block-comment1.wat.err
new file mode 100644
index 0000000000..5f6a8670e9
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment1.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{202b}'
+ --> tests/parse-fail/confusing-block-comment1.wat:1:13
+ |
+ 1 | (module) (; ;)
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment2.wat b/third_party/rust/wast/tests/parse-fail/confusing-block-comment2.wat
new file mode 100644
index 0000000000..ee0d705a8c
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment2.wat
@@ -0,0 +1 @@
+(module) (; ‭ ;)
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment2.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-block-comment2.wat.err
new file mode 100644
index 0000000000..08f77e4244
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment2.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{202d}'
+ --> tests/parse-fail/confusing-block-comment2.wat:1:13
+ |
+ 1 | (module) (; ;)
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment3.wat b/third_party/rust/wast/tests/parse-fail/confusing-block-comment3.wat
new file mode 100644
index 0000000000..cd849f21bb
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment3.wat
@@ -0,0 +1 @@
+(module) (; ‮ ;)
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment3.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-block-comment3.wat.err
new file mode 100644
index 0000000000..5da080d3b7
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment3.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{202e}'
+ --> tests/parse-fail/confusing-block-comment3.wat:1:13
+ |
+ 1 | (module) (; ;)
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment4.wat b/third_party/rust/wast/tests/parse-fail/confusing-block-comment4.wat
new file mode 100644
index 0000000000..6c64d834ad
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment4.wat
@@ -0,0 +1 @@
+(module) (; ⁦ ;)
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment4.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-block-comment4.wat.err
new file mode 100644
index 0000000000..3f3aacf9fa
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment4.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{2066}'
+ --> tests/parse-fail/confusing-block-comment4.wat:1:13
+ |
+ 1 | (module) (; ;)
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment5.wat b/third_party/rust/wast/tests/parse-fail/confusing-block-comment5.wat
new file mode 100644
index 0000000000..f354821595
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment5.wat
@@ -0,0 +1 @@
+(module) (; ⁧ ;)
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment5.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-block-comment5.wat.err
new file mode 100644
index 0000000000..547c85961b
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment5.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{2067}'
+ --> tests/parse-fail/confusing-block-comment5.wat:1:13
+ |
+ 1 | (module) (; ;)
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment6.wat b/third_party/rust/wast/tests/parse-fail/confusing-block-comment6.wat
new file mode 100644
index 0000000000..c394085a6c
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment6.wat
@@ -0,0 +1 @@
+(module) (; ⁨ ;)
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment6.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-block-comment6.wat.err
new file mode 100644
index 0000000000..0cbc9d70bf
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment6.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{2068}'
+ --> tests/parse-fail/confusing-block-comment6.wat:1:13
+ |
+ 1 | (module) (; ;)
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment7.wat b/third_party/rust/wast/tests/parse-fail/confusing-block-comment7.wat
new file mode 100644
index 0000000000..2977dcf187
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment7.wat
@@ -0,0 +1 @@
+(module) (;  ;)
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment7.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-block-comment7.wat.err
new file mode 100644
index 0000000000..5242574415
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment7.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{206c}'
+ --> tests/parse-fail/confusing-block-comment7.wat:1:13
+ |
+ 1 | (module) (; ;)
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment8.wat b/third_party/rust/wast/tests/parse-fail/confusing-block-comment8.wat
new file mode 100644
index 0000000000..3d44c01486
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment8.wat
@@ -0,0 +1 @@
+(module) (; ⁩ ;)
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-block-comment8.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-block-comment8.wat.err
new file mode 100644
index 0000000000..fe89af152e
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-block-comment8.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{2069}'
+ --> tests/parse-fail/confusing-block-comment8.wat:1:13
+ |
+ 1 | (module) (; ;)
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment0.wat b/third_party/rust/wast/tests/parse-fail/confusing-line-comment0.wat
new file mode 100644
index 0000000000..72e8caa7dd
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment0.wat
@@ -0,0 +1 @@
+(module) ;; ‪
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment0.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-line-comment0.wat.err
new file mode 100644
index 0000000000..1d665d7f74
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment0.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{202a}'
+ --> tests/parse-fail/confusing-line-comment0.wat:1:13
+ |
+ 1 | (module) ;;
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment1.wat b/third_party/rust/wast/tests/parse-fail/confusing-line-comment1.wat
new file mode 100644
index 0000000000..af7e5e6341
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment1.wat
@@ -0,0 +1 @@
+(module) ;; ‫
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment1.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-line-comment1.wat.err
new file mode 100644
index 0000000000..e614bad736
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment1.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{202b}'
+ --> tests/parse-fail/confusing-line-comment1.wat:1:13
+ |
+ 1 | (module) ;;
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment2.wat b/third_party/rust/wast/tests/parse-fail/confusing-line-comment2.wat
new file mode 100644
index 0000000000..ac67c0e6be
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment2.wat
@@ -0,0 +1 @@
+(module) ;; ‭
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment2.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-line-comment2.wat.err
new file mode 100644
index 0000000000..e5f1fda5ee
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment2.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{202d}'
+ --> tests/parse-fail/confusing-line-comment2.wat:1:13
+ |
+ 1 | (module) ;;
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment3.wat b/third_party/rust/wast/tests/parse-fail/confusing-line-comment3.wat
new file mode 100644
index 0000000000..57e38b223c
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment3.wat
@@ -0,0 +1 @@
+(module) ;; ‮
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment3.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-line-comment3.wat.err
new file mode 100644
index 0000000000..787c019767
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment3.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{202e}'
+ --> tests/parse-fail/confusing-line-comment3.wat:1:13
+ |
+ 1 | (module) ;;
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment4.wat b/third_party/rust/wast/tests/parse-fail/confusing-line-comment4.wat
new file mode 100644
index 0000000000..d066d64be2
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment4.wat
@@ -0,0 +1 @@
+(module) ;; ⁦
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment4.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-line-comment4.wat.err
new file mode 100644
index 0000000000..9c5951c743
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment4.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{2066}'
+ --> tests/parse-fail/confusing-line-comment4.wat:1:13
+ |
+ 1 | (module) ;;
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment5.wat b/third_party/rust/wast/tests/parse-fail/confusing-line-comment5.wat
new file mode 100644
index 0000000000..02ca3e2336
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment5.wat
@@ -0,0 +1 @@
+(module) ;; ⁧
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment5.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-line-comment5.wat.err
new file mode 100644
index 0000000000..f0d96fdba7
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment5.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{2067}'
+ --> tests/parse-fail/confusing-line-comment5.wat:1:13
+ |
+ 1 | (module) ;;
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment6.wat b/third_party/rust/wast/tests/parse-fail/confusing-line-comment6.wat
new file mode 100644
index 0000000000..7d5f48f789
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment6.wat
@@ -0,0 +1 @@
+(module) ;; ⁨
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment6.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-line-comment6.wat.err
new file mode 100644
index 0000000000..9e92eeb69e
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment6.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{2068}'
+ --> tests/parse-fail/confusing-line-comment6.wat:1:13
+ |
+ 1 | (module) ;;
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment7.wat b/third_party/rust/wast/tests/parse-fail/confusing-line-comment7.wat
new file mode 100644
index 0000000000..21f589d9d8
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment7.wat
@@ -0,0 +1 @@
+(module) ;; 
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment7.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-line-comment7.wat.err
new file mode 100644
index 0000000000..2e8dc1837c
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment7.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{206c}'
+ --> tests/parse-fail/confusing-line-comment7.wat:1:13
+ |
+ 1 | (module) ;;
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment8.wat b/third_party/rust/wast/tests/parse-fail/confusing-line-comment8.wat
new file mode 100644
index 0000000000..03c2c18c2e
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment8.wat
@@ -0,0 +1 @@
+(module) ;; ⁩
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-line-comment8.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-line-comment8.wat.err
new file mode 100644
index 0000000000..41f28156f5
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-line-comment8.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{2069}'
+ --> tests/parse-fail/confusing-line-comment8.wat:1:13
+ |
+ 1 | (module) ;;
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string0.wat b/third_party/rust/wast/tests/parse-fail/confusing-string0.wat
new file mode 100644
index 0000000000..e582b23320
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string0.wat
@@ -0,0 +1 @@
+(module (export "‪" (func 0)))
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string0.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-string0.wat.err
new file mode 100644
index 0000000000..13a567b958
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string0.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{202a}'
+ --> tests/parse-fail/confusing-string0.wat:1:18
+ |
+ 1 | (module (export "" (func 0)))
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string1.wat b/third_party/rust/wast/tests/parse-fail/confusing-string1.wat
new file mode 100644
index 0000000000..a294d96131
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string1.wat
@@ -0,0 +1 @@
+(module (export "‫" (func 0)))
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string1.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-string1.wat.err
new file mode 100644
index 0000000000..5afd670e24
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string1.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{202b}'
+ --> tests/parse-fail/confusing-string1.wat:1:18
+ |
+ 1 | (module (export "" (func 0)))
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string2.wat b/third_party/rust/wast/tests/parse-fail/confusing-string2.wat
new file mode 100644
index 0000000000..7ba6b04b85
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string2.wat
@@ -0,0 +1 @@
+(module (export "‭" (func 0)))
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string2.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-string2.wat.err
new file mode 100644
index 0000000000..a40ddec831
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string2.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{202d}'
+ --> tests/parse-fail/confusing-string2.wat:1:18
+ |
+ 1 | (module (export "" (func 0)))
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string3.wat b/third_party/rust/wast/tests/parse-fail/confusing-string3.wat
new file mode 100644
index 0000000000..4b71b620f4
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string3.wat
@@ -0,0 +1 @@
+(module (export "‮" (func 0)))
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string3.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-string3.wat.err
new file mode 100644
index 0000000000..e3e04e8f5a
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string3.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{202e}'
+ --> tests/parse-fail/confusing-string3.wat:1:18
+ |
+ 1 | (module (export "" (func 0)))
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string4.wat b/third_party/rust/wast/tests/parse-fail/confusing-string4.wat
new file mode 100644
index 0000000000..b4261ae2fe
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string4.wat
@@ -0,0 +1 @@
+(module (export "⁦" (func 0)))
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string4.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-string4.wat.err
new file mode 100644
index 0000000000..dde3f003a6
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string4.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{2066}'
+ --> tests/parse-fail/confusing-string4.wat:1:18
+ |
+ 1 | (module (export "" (func 0)))
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string5.wat b/third_party/rust/wast/tests/parse-fail/confusing-string5.wat
new file mode 100644
index 0000000000..1e0316b592
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string5.wat
@@ -0,0 +1 @@
+(module (export "⁧" (func 0)))
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string5.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-string5.wat.err
new file mode 100644
index 0000000000..ee4cdc4c37
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string5.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{2067}'
+ --> tests/parse-fail/confusing-string5.wat:1:18
+ |
+ 1 | (module (export "" (func 0)))
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string6.wat b/third_party/rust/wast/tests/parse-fail/confusing-string6.wat
new file mode 100644
index 0000000000..e0a4a84e8e
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string6.wat
@@ -0,0 +1 @@
+(module (export "⁨" (func 0)))
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string6.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-string6.wat.err
new file mode 100644
index 0000000000..d30342556a
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string6.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{2068}'
+ --> tests/parse-fail/confusing-string6.wat:1:18
+ |
+ 1 | (module (export "" (func 0)))
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string7.wat b/third_party/rust/wast/tests/parse-fail/confusing-string7.wat
new file mode 100644
index 0000000000..c920e2df7b
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string7.wat
@@ -0,0 +1 @@
+(module (export "" (func 0)))
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string7.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-string7.wat.err
new file mode 100644
index 0000000000..015fb5cf79
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string7.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{206c}'
+ --> tests/parse-fail/confusing-string7.wat:1:18
+ |
+ 1 | (module (export "" (func 0)))
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string8.wat b/third_party/rust/wast/tests/parse-fail/confusing-string8.wat
new file mode 100644
index 0000000000..4ae212db2c
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string8.wat
@@ -0,0 +1 @@
+(module (export "⁩" (func 0)))
diff --git a/third_party/rust/wast/tests/parse-fail/confusing-string8.wat.err b/third_party/rust/wast/tests/parse-fail/confusing-string8.wat.err
new file mode 100644
index 0000000000..197e0dad10
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/confusing-string8.wat.err
@@ -0,0 +1,5 @@
+likely-confusing unicode character found '\u{2069}'
+ --> tests/parse-fail/confusing-string8.wat:1:18
+ |
+ 1 | (module (export "" (func 0)))
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/inline1.wat b/third_party/rust/wast/tests/parse-fail/inline1.wat
new file mode 100644
index 0000000000..3d338d34aa
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/inline1.wat
@@ -0,0 +1,4 @@
+(type $sig (func))
+(table 0 funcref)
+(func (result i32)
+ (call_indirect (type $sig) (result i32) (i32.const 0)))
diff --git a/third_party/rust/wast/tests/parse-fail/inline1.wat.err b/third_party/rust/wast/tests/parse-fail/inline1.wat.err
new file mode 100644
index 0000000000..c9d96acf7e
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/inline1.wat.err
@@ -0,0 +1,5 @@
+inline function type doesn't match type reference
+ --> tests/parse-fail/inline1.wat:4:24
+ |
+ 4 | (call_indirect (type $sig) (result i32) (i32.const 0)))
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/newline-in-string.wat b/third_party/rust/wast/tests/parse-fail/newline-in-string.wat
new file mode 100644
index 0000000000..1cc80efa6f
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/newline-in-string.wat
@@ -0,0 +1 @@
+"
diff --git a/third_party/rust/wast/tests/parse-fail/newline-in-string.wat.err b/third_party/rust/wast/tests/parse-fail/newline-in-string.wat.err
new file mode 100644
index 0000000000..528be7e0e0
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/newline-in-string.wat.err
@@ -0,0 +1,5 @@
+invalid character in string '\n'
+ --> tests/parse-fail/newline-in-string.wat:1:2
+ |
+ 1 | "
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/string1.wat b/third_party/rust/wast/tests/parse-fail/string1.wat
new file mode 100644
index 0000000000..b950069525
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string1.wat
@@ -0,0 +1,2 @@
+(module
+ (import " \ No newline at end of file
diff --git a/third_party/rust/wast/tests/parse-fail/string1.wat.err b/third_party/rust/wast/tests/parse-fail/string1.wat.err
new file mode 100644
index 0000000000..94de4fd608
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string1.wat.err
@@ -0,0 +1,5 @@
+unexpected end-of-file
+ --> tests/parse-fail/string1.wat:2:12
+ |
+ 2 | (import "
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/string10.wat b/third_party/rust/wast/tests/parse-fail/string10.wat
new file mode 100644
index 0000000000..62a551a1bc
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string10.wat
@@ -0,0 +1 @@
+"\u{1_}"
diff --git a/third_party/rust/wast/tests/parse-fail/string10.wat.err b/third_party/rust/wast/tests/parse-fail/string10.wat.err
new file mode 100644
index 0000000000..62d635a58a
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string10.wat.err
@@ -0,0 +1,5 @@
+bare underscore in numeric literal
+ --> tests/parse-fail/string10.wat:1:6
+ |
+ 1 | "\u{1_}"
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/string11.wat b/third_party/rust/wast/tests/parse-fail/string11.wat
new file mode 100644
index 0000000000..3be622718f
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string11.wat
@@ -0,0 +1 @@
+"\u{fffffffffffffffff}"
diff --git a/third_party/rust/wast/tests/parse-fail/string11.wat.err b/third_party/rust/wast/tests/parse-fail/string11.wat.err
new file mode 100644
index 0000000000..fdf4d37fa2
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string11.wat.err
@@ -0,0 +1,5 @@
+number is too big to parse
+ --> tests/parse-fail/string11.wat:1:13
+ |
+ 1 | "\u{fffffffffffffffff}"
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/string12.wat b/third_party/rust/wast/tests/parse-fail/string12.wat
new file mode 100644
index 0000000000..1720d5bb46
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string12.wat
@@ -0,0 +1 @@
+"\u{ffffffff}"
diff --git a/third_party/rust/wast/tests/parse-fail/string12.wat.err b/third_party/rust/wast/tests/parse-fail/string12.wat.err
new file mode 100644
index 0000000000..743a21500e
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string12.wat.err
@@ -0,0 +1,5 @@
+invalid unicode scalar value 0xffffffff
+ --> tests/parse-fail/string12.wat:1:12
+ |
+ 1 | "\u{ffffffff}"
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/string13.wat b/third_party/rust/wast/tests/parse-fail/string13.wat
new file mode 100644
index 0000000000..f7eac8fea1
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string13.wat
@@ -0,0 +1 @@
+"\u"
diff --git a/third_party/rust/wast/tests/parse-fail/string13.wat.err b/third_party/rust/wast/tests/parse-fail/string13.wat.err
new file mode 100644
index 0000000000..509b94791f
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string13.wat.err
@@ -0,0 +1,5 @@
+expected '{' but found '"'
+ --> tests/parse-fail/string13.wat:1:4
+ |
+ 1 | "\u"
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/string14.wat b/third_party/rust/wast/tests/parse-fail/string14.wat
new file mode 100644
index 0000000000..936dbf8b67
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string14.wat
@@ -0,0 +1 @@
+"\u{"
diff --git a/third_party/rust/wast/tests/parse-fail/string14.wat.err b/third_party/rust/wast/tests/parse-fail/string14.wat.err
new file mode 100644
index 0000000000..2eba9bafb1
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string14.wat.err
@@ -0,0 +1,5 @@
+invalid hex digit '"'
+ --> tests/parse-fail/string14.wat:1:5
+ |
+ 1 | "\u{"
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/string15.wat b/third_party/rust/wast/tests/parse-fail/string15.wat
new file mode 100644
index 0000000000..58e0e36227
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string15.wat
@@ -0,0 +1 @@
+"\u{3"
diff --git a/third_party/rust/wast/tests/parse-fail/string15.wat.err b/third_party/rust/wast/tests/parse-fail/string15.wat.err
new file mode 100644
index 0000000000..cdd89397f7
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string15.wat.err
@@ -0,0 +1,5 @@
+expected '}' but found '"'
+ --> tests/parse-fail/string15.wat:1:6
+ |
+ 1 | "\u{3"
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/string16.wat b/third_party/rust/wast/tests/parse-fail/string16.wat
new file mode 100644
index 0000000000..aa3d8aa06a
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string16.wat
@@ -0,0 +1 @@
+"\u{3 \ No newline at end of file
diff --git a/third_party/rust/wast/tests/parse-fail/string16.wat.err b/third_party/rust/wast/tests/parse-fail/string16.wat.err
new file mode 100644
index 0000000000..874241b197
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string16.wat.err
@@ -0,0 +1,5 @@
+unexpected end-of-file
+ --> tests/parse-fail/string16.wat:1:6
+ |
+ 1 | "\u{3
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/string2.wat b/third_party/rust/wast/tests/parse-fail/string2.wat
new file mode 100644
index 0000000000..9cd719ea0f
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string2.wat
@@ -0,0 +1,2 @@
+(module
+ (import "\x"))
diff --git a/third_party/rust/wast/tests/parse-fail/string2.wat.err b/third_party/rust/wast/tests/parse-fail/string2.wat.err
new file mode 100644
index 0000000000..bb7a7166ce
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string2.wat.err
@@ -0,0 +1,5 @@
+invalid string escape 'x'
+ --> tests/parse-fail/string2.wat:2:13
+ |
+ 2 | (import "\x"))
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/string3.wat b/third_party/rust/wast/tests/parse-fail/string3.wat
new file mode 100644
index 0000000000..d518f71599
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string3.wat
@@ -0,0 +1,3 @@
+(module
+ (import "\0"))
+
diff --git a/third_party/rust/wast/tests/parse-fail/string3.wat.err b/third_party/rust/wast/tests/parse-fail/string3.wat.err
new file mode 100644
index 0000000000..0937725c09
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string3.wat.err
@@ -0,0 +1,5 @@
+invalid hex digit '"'
+ --> tests/parse-fail/string3.wat:2:14
+ |
+ 2 | (import "\0"))
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/string4.wat b/third_party/rust/wast/tests/parse-fail/string4.wat
new file mode 100644
index 0000000000..3c417c1f4f
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string4.wat
@@ -0,0 +1,2 @@
+(module
+ (import "\0 \ No newline at end of file
diff --git a/third_party/rust/wast/tests/parse-fail/string4.wat.err b/third_party/rust/wast/tests/parse-fail/string4.wat.err
new file mode 100644
index 0000000000..3e3f684f74
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string4.wat.err
@@ -0,0 +1,5 @@
+unexpected end-of-file
+ --> tests/parse-fail/string4.wat:2:14
+ |
+ 2 | (import "\0
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/string5.wat b/third_party/rust/wast/tests/parse-fail/string5.wat
new file mode 100644
index 0000000000..00a2584008
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string5.wat
@@ -0,0 +1 @@
+"\ \ No newline at end of file
diff --git a/third_party/rust/wast/tests/parse-fail/string5.wat.err b/third_party/rust/wast/tests/parse-fail/string5.wat.err
new file mode 100644
index 0000000000..6e53ef4038
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string5.wat.err
@@ -0,0 +1,5 @@
+unexpected end-of-file
+ --> tests/parse-fail/string5.wat:1:3
+ |
+ 1 | "\
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/string6.wat b/third_party/rust/wast/tests/parse-fail/string6.wat
new file mode 100644
index 0000000000..67a8d48922
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string6.wat
Binary files differ
diff --git a/third_party/rust/wast/tests/parse-fail/string6.wat.err b/third_party/rust/wast/tests/parse-fail/string6.wat.err
new file mode 100644
index 0000000000..4ae317c08c
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string6.wat.err
Binary files differ
diff --git a/third_party/rust/wast/tests/parse-fail/string7.wat b/third_party/rust/wast/tests/parse-fail/string7.wat
new file mode 100644
index 0000000000..2e40e03cd5
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string7.wat
@@ -0,0 +1 @@
+""
diff --git a/third_party/rust/wast/tests/parse-fail/string7.wat.err b/third_party/rust/wast/tests/parse-fail/string7.wat.err
new file mode 100644
index 0000000000..d7ba1a11a4
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string7.wat.err
@@ -0,0 +1,5 @@
+invalid character in string '\u{7f}'
+ --> tests/parse-fail/string7.wat:1:2
+ |
+ 1 | ""
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/string8.wat b/third_party/rust/wast/tests/parse-fail/string8.wat
new file mode 100644
index 0000000000..5fe9abf854
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string8.wat
@@ -0,0 +1 @@
+""
diff --git a/third_party/rust/wast/tests/parse-fail/string8.wat.err b/third_party/rust/wast/tests/parse-fail/string8.wat.err
new file mode 100644
index 0000000000..68e6d2e550
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string8.wat.err
@@ -0,0 +1,5 @@
+invalid character in string '\u{1f}'
+ --> tests/parse-fail/string8.wat:1:2
+ |
+ 1 | ""
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/string9.wat b/third_party/rust/wast/tests/parse-fail/string9.wat
new file mode 100644
index 0000000000..702916047d
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string9.wat
@@ -0,0 +1 @@
+"\u{x}"
diff --git a/third_party/rust/wast/tests/parse-fail/string9.wat.err b/third_party/rust/wast/tests/parse-fail/string9.wat.err
new file mode 100644
index 0000000000..ff3ec4ac1d
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/string9.wat.err
@@ -0,0 +1,5 @@
+invalid hex digit 'x'
+ --> tests/parse-fail/string9.wat:1:5
+ |
+ 1 | "\u{x}"
+ | ^
diff --git a/third_party/rust/wast/tests/parse-fail/unbalanced.wat b/third_party/rust/wast/tests/parse-fail/unbalanced.wat
new file mode 100644
index 0000000000..49eaf835ad
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/unbalanced.wat
@@ -0,0 +1,3 @@
+(module)
+
+)
diff --git a/third_party/rust/wast/tests/parse-fail/unbalanced.wat.err b/third_party/rust/wast/tests/parse-fail/unbalanced.wat.err
new file mode 100644
index 0000000000..c4eff2c09d
--- /dev/null
+++ b/third_party/rust/wast/tests/parse-fail/unbalanced.wat.err
@@ -0,0 +1,5 @@
+extra tokens remaining after parse
+ --> tests/parse-fail/unbalanced.wat:3:1
+ |
+ 3 | )
+ | ^
diff --git a/third_party/rust/wast/tests/recursive.rs b/third_party/rust/wast/tests/recursive.rs
new file mode 100644
index 0000000000..e06e78385e
--- /dev/null
+++ b/third_party/rust/wast/tests/recursive.rs
@@ -0,0 +1,8 @@
+#[test]
+fn no_stack_overflow() {
+ let mut s = format!("(module (func \n");
+ for _ in 0..10_000 {
+ s.push_str("(i32.add\n");
+ }
+ assert!(wat::parse_str(&s).is_err());
+}