Skip to content

Upgrade to latest Rust. #21

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

Merged
merged 1 commit into from
Oct 18, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 std::{io, os, str, run, task};
use std::{io, str, run, task};
use extra::{tempfile, json};
use extra::json::ToJson;

Expand Down Expand Up @@ -33,19 +33,19 @@ fn almost_equals(a: &json::Json, b: &json::Json) -> bool {

fn assert_json_eq(results: json::Json, expected: json::Json, message: ~str) {
if !almost_equals(&results, &expected) {
let temp = tempfile::mkdtemp(&os::tmpdir(), "rust-cssparser-tests").unwrap();
let temp_ = temp.clone();
let temp = tempfile::TempDir::new("rust-cssparser-tests").unwrap();
let results = results.to_pretty_str() + "\n";
let expected = expected.to_pretty_str() + "\n";
do task::try {
let result_path = temp.push("results.json");
let expected_path = temp.push("expected.json");
let mut result_path = temp.path().clone();
result_path.push("results.json");
let mut expected_path = temp.path().clone();
expected_path.push("expected.json");
write_whole_file(&result_path, results);
write_whole_file(&expected_path, expected);
run::process_status("colordiff", [~"-u1000", result_path.to_str(),
expected_path.to_str()]);
run::process_status("colordiff", [~"-u1000", result_path.display().to_str(),
expected_path.display().to_str()]);
};
os::remove_dir_recursive(&temp_);

fail!(message)
}
Expand Down Expand Up @@ -268,7 +268,7 @@ impl ToJson for AtRule {
match *self {
AtRule{name: ref name, prelude: ref prelude, block: ref block, _}
=> json::List(~[json::String(~"at-rule"), name.to_json(),
prelude.to_json(), block.map(list_to_json).to_json()])
prelude.to_json(), block.as_ref().map(list_to_json).to_json()])
}
}
}
Expand Down