Skip to content

Commit

Permalink
witx: add a multimodule test that rejects redefined names
Browse files Browse the repository at this point in the history
and rename the path to be a litle shorter
  • Loading branch information
Pat Hickey committed Nov 12, 2019
1 parent 51d8503 commit 7f736b0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use witx::{load, BuiltinType, DatatypeIdent, DatatypeVariant, Id};

#[test]
fn validate_simple_multimodule() {
fn validate_multimodule() {
// B uses A, and C uses A.
let doc = load(&[
"tests/simple_multimodule/type_b.witx",
"tests/simple_multimodule/type_c.witx",
"tests/multimodule/type_b.witx",
"tests/multimodule/type_c.witx",
])
.unwrap_or_else(|e| panic!("failed to parse: {}", e));
.unwrap_or_else(|e| panic!("failed to validate: {}", e));

println!("{}", doc);

Expand Down Expand Up @@ -51,3 +51,12 @@ fn validate_simple_multimodule() {
_ => panic!("c is a struct"),
}
}

#[test]
fn multimodule_reject_redefinition() {
assert!(load(&[
"tests/multimodule/type_a.witx",
"tests/multimodule/redefine_a.witx",
])
.is_err())
}
1 change: 1 addition & 0 deletions tools/witx/tests/multimodule/redefine_a.witx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(typename $a u8)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7f736b0

Please sign in to comment.