b352b12c48
Even though we currently depend on rustc-serialize, this may not always be the case. Forcing opt-in for all integration with external crates is a safer course of action.
23 lines
774 B
Rust
23 lines
774 B
Rust
use serialize::json::Json;
|
|
|
|
use types::test_type;
|
|
|
|
#[test]
|
|
fn test_json_params() {
|
|
test_type("JSON", &[(Some(Json::from_str("[10, 11, 12]").unwrap()),
|
|
"'[10, 11, 12]'"),
|
|
(Some(Json::from_str("{\"f\": \"asd\"}").unwrap()),
|
|
"'{\"f\": \"asd\"}'"),
|
|
(None, "NULL")])
|
|
}
|
|
|
|
#[test]
|
|
fn test_jsonb_params() {
|
|
if option_env!("TRAVIS").is_some() { return } // Travis doesn't have Postgres 9.4 yet
|
|
test_type("JSONB", &[(Some(Json::from_str("[10, 11, 12]").unwrap()),
|
|
"'[10, 11, 12]'"),
|
|
(Some(Json::from_str("{\"f\": \"asd\"}").unwrap()),
|
|
"'{\"f\": \"asd\"}'"),
|
|
(None, "NULL")])
|
|
}
|