Skip to content

Commit 153b10d

Browse files
committed
Upgrade to latest Rust.
1 parent 87715dd commit 153b10d

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
use std::{io, os, str, run, task};
5+
use std::{io, str, run, task};
66
use extra::{tempfile, json};
77
use extra::json::ToJson;
88

@@ -33,19 +33,19 @@ fn almost_equals(a: &json::Json, b: &json::Json) -> bool {
3333
3434
fn assert_json_eq(results: json::Json, expected: json::Json, message: ~str) {
3535
if !almost_equals(&results, &expected) {
36-
let temp = tempfile::mkdtemp(&os::tmpdir(), "rust-cssparser-tests").unwrap();
37-
let temp_ = temp.clone();
36+
let temp = tempfile::TempDir::new("rust-cssparser-tests").unwrap();
3837
let results = results.to_pretty_str() + "\n";
3938
let expected = expected.to_pretty_str() + "\n";
4039
do task::try {
41-
let result_path = temp.push("results.json");
42-
let expected_path = temp.push("expected.json");
40+
let mut result_path = temp.path().clone();
41+
result_path.push("results.json");
42+
let mut expected_path = temp.path().clone();
43+
expected_path.push("expected.json");
4344
write_whole_file(&result_path, results);
4445
write_whole_file(&expected_path, expected);
45-
run::process_status("colordiff", [~"-u1000", result_path.to_str(),
46-
expected_path.to_str()]);
46+
run::process_status("colordiff", [~"-u1000", result_path.display().to_str(),
47+
expected_path.display().to_str()]);
4748
};
48-
os::remove_dir_recursive(&temp_);
4949
5050
fail!(message)
5151
}
@@ -268,7 +268,7 @@ impl ToJson for AtRule {
268268
match *self {
269269
AtRule{name: ref name, prelude: ref prelude, block: ref block, _}
270270
=> json::List(~[json::String(~"at-rule"), name.to_json(),
271-
prelude.to_json(), block.map(list_to_json).to_json()])
271+
prelude.to_json(), block.as_ref().map(list_to_json).to_json()])
272272
}
273273
}
274274
}

0 commit comments

Comments
 (0)