Created
August 12, 2019 17:19
-
-
Save bstpierre/8a8445e4d60d651ff7a79dc29bb961ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "rocket-contrib-test" | |
version = "0.1.0" | |
authors = ["bstpierre"] | |
edition = "2018" | |
[dependencies] | |
rocket_contrib = "0.4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiling rocket-contrib-test v0.1.0 (/home/bstpierre/projects/rust/rocket-contrib-test) | |
warning: unused `#[macro_use]` import | |
--> src/lib.rs:1:1 | |
| | |
1 | #[macro_use] extern crate rocket_contrib; | |
| ^^^^^^^^^^^^ | |
| | |
= note: `#[warn(unused_imports)]` on by default | |
error[E0277]: can't compare `serde_json::value::Value` with `rocket_contrib::json::JsonValue` | |
--> src/lib.rs:14:2 | |
| | |
14 | assert_eq!(object["B"][0], json!("b")); | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `serde_json::value::Value == rocket_contrib::json::JsonValue` | |
| | |
= help: the trait `std::cmp::PartialEq<rocket_contrib::json::JsonValue>` is not implemented for `serde_json::value::Value` | |
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) | |
error[E0277]: can't compare `serde_json::value::Value` with `rocket_contrib::json::JsonValue` | |
--> src/lib.rs:16:2 | |
| | |
16 | assert_eq!(object["D"], json!(null)); | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `serde_json::value::Value == rocket_contrib::json::JsonValue` | |
| | |
= help: the trait `std::cmp::PartialEq<rocket_contrib::json::JsonValue>` is not implemented for `serde_json::value::Value` | |
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) | |
error[E0277]: can't compare `serde_json::value::Value` with `rocket_contrib::json::JsonValue` | |
--> src/lib.rs:17:2 | |
| | |
17 | assert_eq!(object[0]["x"]["y"]["z"], json!(null)); | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `serde_json::value::Value == rocket_contrib::json::JsonValue` | |
| | |
= help: the trait `std::cmp::PartialEq<rocket_contrib::json::JsonValue>` is not implemented for `serde_json::value::Value` | |
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) | |
error: aborting due to 3 previous errors | |
For more information about this error, try `rustc --explain E0277`. | |
error: Could not compile `rocket-contrib-test`. | |
To learn more, run the command again with --verbose. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_use] extern crate rocket_contrib; | |
#[cfg(test)] | |
mod tests { | |
// use rocket_contrib::json::Json; | |
#[test] | |
fn it_works() { | |
let object = json!({ | |
"A": ["a", "á", "à"], | |
"B": ["b", "b́"], | |
"C": ["c", "ć", "ć̣", "ḉ"], | |
}); | |
assert_eq!(object["B"][0], json!("b")); | |
assert_eq!(object["D"], json!(null)); | |
assert_eq!(object[0]["x"]["y"]["z"], json!(null)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment