Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace rustc_serialize with serde_json in style_tests #18710

Merged
merged 1 commit into from Nov 16, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

removed rustc_serialize in style tests

  • Loading branch information
mhaessig committed Oct 15, 2017
commit 93cee84f9ffc1a947fd756e94fd322d42d0bbf3a

Some generated files are not rendered by default. Learn more.

@@ -17,7 +17,7 @@ euclid = "0.15"
html5ever = "0.20"
parking_lot = "0.4"
rayon = "0.8"
rustc-serialize = "0.3"
serde_json = "1.0"
selectors = {path = "../../../components/selectors"}
servo_arc = {path = "../../../components/servo_arc"}
servo_atoms = {path = "../../../components/atoms"}
@@ -11,8 +11,8 @@ extern crate euclid;
#[macro_use] extern crate html5ever;
extern crate parking_lot;
extern crate rayon;
extern crate rustc_serialize;
extern crate selectors;
extern crate serde_json;
extern crate servo_arc;
extern crate servo_atoms;
extern crate servo_config;
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use rustc_serialize::json::Json;
use serde_json::{self, Value};
use std::env;
use std::fs::{File, remove_file};
use std::path::Path;
@@ -25,10 +25,11 @@ fn properties_list_json() {
.status()
.unwrap();
assert!(status.success());
let properties = Json::from_reader(&mut File::open(json).unwrap()).unwrap();

let properties: Value = serde_json::from_reader(File::open(json).unwrap()).unwrap();

This comment has been minimized.

@dtolnay

dtolnay Nov 15, 2017

Contributor

You could deserialize directly to serde_json::Map<String, Value> instead of Value and save those as_object().unwrap() calls.

assert!(properties.as_object().unwrap().len() > 100);
assert!(properties.find("margin").is_some());
assert!(properties.find("margin-top").is_some());
assert!(properties.as_object().unwrap().contains_key("margin"));
assert!(properties.as_object().unwrap().contains_key("margin-top"));
}

#[cfg(windows)]
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.