Skip to content

Commit

Permalink
chore: Ignore integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
macisamuele authored and Stranger6667 committed May 14, 2020
1 parent 3f1885d commit 6645e06
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ fn main() {
}
```

Fully supported drafts (with optional test cases included):
Supported drafts:
- Draft 7
- Draft 6
- Draft 4 (except optional `bignum.json` test case)

## Performance

Expand Down
11 changes: 11 additions & 0 deletions draft/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ use std::fs::File;
use std::io::Read;
use std::path::Path;

const TEST_TO_IGNORE: &[&str] = &["draft4_optional_bignum"];

fn should_ignore_test(prefix_test_name: &str) -> bool {
TEST_TO_IGNORE
.iter()
.any(|test_to_ignore| prefix_test_name.starts_with(test_to_ignore))
}

#[proc_macro]
pub fn test_draft(input: TokenStream) -> TokenStream {
let dir_name = input.to_string();
Expand All @@ -28,6 +36,9 @@ pub fn test_draft(input: TokenStream) -> TokenStream {
let description = test.get("description").unwrap().as_str().unwrap();
let data = test.get("data").unwrap();
let valid = test.get("valid").unwrap().as_bool().unwrap();
if should_ignore_test(&file_name) {
output.push_str("\n#[ignore]\n");
}
output.push_str("\n#[test]\n");
output.push_str(&format!("fn {}_{}_{}()", file_name, i, j));
output.push_str(&make_fn_body(schema, data, &description, valid, &draft))
Expand Down

0 comments on commit 6645e06

Please sign in to comment.