From 6645e0628234b8369ab600f109934c6251e42507 Mon Sep 17 00:00:00 2001 From: Samuele Maci Date: Mon, 11 May 2020 23:13:30 +0100 Subject: [PATCH] chore: Ignore integration tests --- README.md | 3 ++- draft/src/lib.rs | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e898e77d..8968e3fc 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/draft/src/lib.rs b/draft/src/lib.rs index bc5a5afa..eeb461ed 100644 --- a/draft/src/lib.rs +++ b/draft/src/lib.rs @@ -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(); @@ -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))