|
2 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this
|
3 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
4 | 4 |
|
5 |
| -use std::{io, os, str, run, task}; |
| 5 | +use std::{io, str, run, task}; |
6 | 6 | use extra::{tempfile, json};
|
7 | 7 | use extra::json::ToJson;
|
8 | 8 |
|
@@ -33,19 +33,19 @@ fn almost_equals(a: &json::Json, b: &json::Json) -> bool {
|
33 | 33 |
|
34 | 34 | fn assert_json_eq(results: json::Json, expected: json::Json, message: ~str) {
|
35 | 35 | 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(); |
38 | 37 | let results = results.to_pretty_str() + "\n";
|
39 | 38 | let expected = expected.to_pretty_str() + "\n";
|
40 | 39 | 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"); |
43 | 44 | write_whole_file(&result_path, results);
|
44 | 45 | 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()]); |
47 | 48 | };
|
48 |
| - os::remove_dir_recursive(&temp_); |
49 | 49 |
|
50 | 50 | fail!(message)
|
51 | 51 | }
|
@@ -268,7 +268,7 @@ impl ToJson for AtRule {
|
268 | 268 | match *self {
|
269 | 269 | AtRule{name: ref name, prelude: ref prelude, block: ref block, _}
|
270 | 270 | => 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()]) |
272 | 272 | }
|
273 | 273 | }
|
274 | 274 | }
|
|
0 commit comments