#[test] fn single_after() { let mut items = willdo::config::read("when: [{ done: abc }]".as_bytes(), "urn:reader") .into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn null() { let mut items = willdo::config::read("when: ".as_bytes(), "urn:reader") .into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn single_after_multiple() { let mut items = willdo::config::read( r###" when: - done: [abc,def] "### .as_bytes(), "urn:reader", ) .into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn single_after_none() { let mut items = willdo::config::read( r###" when: - done: "### .as_bytes(), "urn:reader", ) .into_iter(); items.next().expect("foo").expect_err("foo"); } #[test] fn single_after_code() { let mut items = willdo::config::read( r###" when: - done: abc code: 1 "### .as_bytes(), "urn:reader", ) .into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn single_after_code_range_and_mask() { let mut items = willdo::config::read( r###" when: - done: abc code: min: 3 max: 20 mask: 2 "### .as_bytes(), "urn:reader", ) .into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn single_after_code_range_without_mask() { let mut items = willdo::config::read( r###" when: - done: abc code: min: 3 max: 20 "### .as_bytes(), "urn:reader", ) .into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn single_after_code_mask_without_range() { let mut items = willdo::config::read( r###" when: - done: abc code: mask: 1 "### .as_bytes(), "urn:reader", ) .into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn single_after_code_min() { let mut items = willdo::config::read( r###" when: - done: abc code: min: 10 "### .as_bytes(), "urn:reader", ) .into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn single_after_code_max() { let mut items = willdo::config::read( r###" when: - done: abc code: max: 100 "### .as_bytes(), "urn:reader", ) .into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn single_after_code_range_inverse() { let mut items = willdo::config::read( r###" when: - done: abc code: max: 100 min: 110 "### .as_bytes(), "urn:reader", ) .into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn single_after_code_complex() { let mut items = willdo::config::read( r###" when: - done: abc code: - max: 100 min: 110 - 3 - mask: 0x4 "### .as_bytes(), "urn:reader", ) .into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn fail_empty_object() { let mut items = willdo::config::read( r###" when: {} "### .as_bytes(), "urn:reader", ) .into_iter(); assert!(items.next().expect("foo").is_err()); } #[test] fn code_empty_object() { let mut items = willdo::config::read( r###" when: - done: abc code: {} "### .as_bytes(), "urn:reader", ) .into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); }