#[test] fn null() { let mut items = willdo::config::read("script: ~".as_bytes(), "urn:reader").into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn empty() { let mut items = willdo::config::read("script:".as_bytes(), "urn:reader").into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn single() { let mut items = willdo::config::read("script: abc".as_bytes(), "urn:reader").into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn number() { let mut items = willdo::config::read("script: 123".as_bytes(), "urn:reader").into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn boolish() { let mut items = willdo::config::read("script: true".as_bytes(), "urn:reader").into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn empty_list() { let mut items = willdo::config::read( r###" script: [] "### .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###" script: {} "### .as_bytes(), "urn:reader", ) .into_iter(); assert!(items.next().expect("foo").is_err()); } #[test] fn list() { let mut items = willdo::config::read( r###" script: - echo ok "### .as_bytes(), "urn:reader", ) .into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn complex() { let mut items = willdo::config::read(r###" script: - true - 1 - .555 - yes "###.as_bytes(), "urn:reader").into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); } #[test] fn fail_complex_null() { let mut items = willdo::config::read(r###" script: - null "###.as_bytes(), "urn:reader").into_iter(); assert!(items.next().expect("foo").is_err()); } #[test] fn fail_complex_tilde() { let mut items = willdo::config::read(r###" script: - ~ "###.as_bytes(), "urn:reader").into_iter(); assert!(items.next().expect("foo").is_err()); } #[test] fn tricky_literals() { let mut items = willdo::config::read(r###" script: - y - n - off - on "###.as_bytes(), "urn:reader").into_iter(); insta::assert_debug_snapshot!(items.next().expect("foo").expect("foo")); }