Skip to content

Commit 46aa080

Browse files
committed
Upgrade to rustc 81eeec094 2014-11-21.
1 parent 29cff53 commit 46aa080

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

src/tests.rs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ macro_rules! JString {
1919
($e: expr) => { json::String($e.to_string()) }
2020
}
2121

22-
macro_rules! JList {
23-
($($e: expr),*) => { json::List(vec!( $($e),* )) }
22+
macro_rules! JArray {
23+
($($e: expr),*) => { json::Array(vec!( $($e),* )) }
2424
}
2525

2626

@@ -62,7 +62,7 @@ fn almost_equals(a: &json::Json, b: &json::Json) -> bool {
6262

6363
(&json::Boolean(a), &json::Boolean(b)) => a == b,
6464
(&json::String(ref a), &json::String(ref b)) => a == b,
65-
(&json::List(ref a), &json::List(ref b))
65+
(&json::Array(ref a), &json::Array(ref b))
6666
=> a.iter().zip(b.iter()).all(|(ref a, ref b)| almost_equals(*a, *b)),
6767
(&json::Object(_), &json::Object(_)) => panic!("Not implemented"),
6868
(&json::Null, &json::Null) => true,
@@ -81,7 +81,7 @@ fn assert_json_eq(results: json::Json, expected: json::Json, message: String) {
8181

8282
fn run_raw_json_tests(json_data: &str, run: |json::Json, json::Json|) {
8383
let items = match json::from_str(json_data) {
84-
Ok(json::List(items)) => items,
84+
Ok(json::Array(items)) => items,
8585
_ => panic!("Invalid JSON")
8686
};
8787
assert!(items.len() % 2 == 0);
@@ -342,7 +342,7 @@ impl ToJson for Result<ComponentValue, SyntaxError> {
342342

343343
impl ToJson for SyntaxError {
344344
fn to_json(&self) -> json::Json {
345-
json::List(vec!(JString!("error"), JString!(match self.reason {
345+
json::Array(vec!(JString!("error"), JString!(match self.reason {
346346
ErrorReason::EmptyInput => "empty",
347347
ErrorReason::ExtraInput => "extra-input",
348348
_ => "invalid",
@@ -394,8 +394,8 @@ impl ToJson for AtRule {
394394
fn to_json(&self) -> json::Json {
395395
match *self {
396396
AtRule{ ref name, ref prelude, ref block, ..}
397-
=> json::List(vec!(JString!("at-rule"), name.to_json(),
398-
prelude.to_json(), block.as_ref().map(list_to_json).to_json()))
397+
=> json::Array(vec!(JString!("at-rule"), name.to_json(),
398+
prelude.to_json(), block.as_ref().map(list_to_json).to_json()))
399399
}
400400
}
401401
}
@@ -405,8 +405,8 @@ impl ToJson for QualifiedRule {
405405
fn to_json(&self) -> json::Json {
406406
match *self {
407407
QualifiedRule{ ref prelude, ref block, ..}
408-
=> json::List(vec!(JString!("qualified rule"),
409-
prelude.to_json(), json::List(list_to_json(block))))
408+
=> json::Array(vec!(JString!("qualified rule"),
409+
prelude.to_json(), json::Array(list_to_json(block))))
410410
}
411411
}
412412
}
@@ -416,8 +416,8 @@ impl ToJson for Declaration {
416416
fn to_json(&self) -> json::Json {
417417
match *self {
418418
Declaration{ ref name, ref value, ref important, ..}
419-
=> json::List(vec!(JString!("declaration"), name.to_json(),
420-
value.to_json(), important.to_json()))
419+
=> json::Array(vec!(JString!("declaration"), name.to_json(),
420+
value.to_json(), important.to_json()))
421421
}
422422
}
423423
}
@@ -434,23 +434,23 @@ impl ToJson for ComponentValue {
434434
}
435435

436436
match *self {
437-
Ident(ref value) => JList!(JString!("ident"), value.to_json()),
438-
AtKeyword(ref value) => JList!(JString!("at-keyword"), value.to_json()),
439-
Hash(ref value) => JList!(JString!("hash"), value.to_json(),
437+
Ident(ref value) => JArray!(JString!("ident"), value.to_json()),
438+
AtKeyword(ref value) => JArray!(JString!("at-keyword"), value.to_json()),
439+
Hash(ref value) => JArray!(JString!("hash"), value.to_json(),
440440
JString!("unrestricted")),
441-
IDHash(ref value) => JList!(JString!("hash"), value.to_json(), JString!("id")),
442-
QuotedString(ref value) => JList!(JString!("string"), value.to_json()),
443-
URL(ref value) => JList!(JString!("url"), value.to_json()),
441+
IDHash(ref value) => JArray!(JString!("hash"), value.to_json(), JString!("id")),
442+
QuotedString(ref value) => JArray!(JString!("string"), value.to_json()),
443+
URL(ref value) => JArray!(JString!("url"), value.to_json()),
444444
Delim('\\') => JString!("\\"),
445445
Delim(value) => json::String(String::from_char(1, value)),
446446

447-
Number(ref value) => json::List(vec!(JString!("number")) + numeric(value)),
448-
Percentage(ref value) => json::List(vec!(JString!("percentage")) + numeric(value)),
449-
Dimension(ref value, ref unit) => json::List(
447+
Number(ref value) => json::Array(vec!(JString!("number")) + numeric(value)),
448+
Percentage(ref value) => json::Array(vec!(JString!("percentage")) + numeric(value)),
449+
Dimension(ref value, ref unit) => json::Array(
450450
vec!(JString!("dimension")) + numeric(value) + [unit.to_json()].as_slice()),
451451

452452
UnicodeRange(start, end)
453-
=> JList!(JString!("unicode-range"), start.to_json(), end.to_json()),
453+
=> JArray!(JString!("unicode-range"), start.to_json(), end.to_json()),
454454

455455
WhiteSpace => JString!(" "),
456456
Colon => JString!(":"),
@@ -466,20 +466,20 @@ impl ToJson for ComponentValue {
466466
CDC => JString!("-->"),
467467

468468
Function(ref name, ref arguments)
469-
=> json::List(vec!(JString!("function"), name.to_json()) +
469+
=> json::Array(vec!(JString!("function"), name.to_json()) +
470470
arguments.iter().map(|a| a.to_json()).collect::<Vec<json::Json>>()),
471471
ParenthesisBlock(ref content)
472-
=> json::List(vec!(JString!("()")) + content.iter().map(|c| c.to_json()).collect::<Vec<json::Json>>()),
472+
=> json::Array(vec!(JString!("()")) + content.iter().map(|c| c.to_json()).collect::<Vec<json::Json>>()),
473473
SquareBracketBlock(ref content)
474-
=> json::List(vec!(JString!("[]")) + content.iter().map(|c| c.to_json()).collect::<Vec<json::Json>>()),
474+
=> json::Array(vec!(JString!("[]")) + content.iter().map(|c| c.to_json()).collect::<Vec<json::Json>>()),
475475
CurlyBracketBlock(ref content)
476-
=> json::List(vec!(JString!("{}")) + list_to_json(content)),
476+
=> json::Array(vec!(JString!("{}")) + list_to_json(content)),
477477

478-
BadURL => JList!(JString!("error"), JString!("bad-url")),
479-
BadString => JList!(JString!("error"), JString!("bad-string")),
480-
CloseParenthesis => JList!(JString!("error"), JString!(")")),
481-
CloseSquareBracket => JList!(JString!("error"), JString!("]")),
482-
CloseCurlyBracket => JList!(JString!("error"), JString!("}")),
478+
BadURL => JArray!(JString!("error"), JString!("bad-url")),
479+
BadString => JArray!(JString!("error"), JString!("bad-string")),
480+
CloseParenthesis => JArray!(JString!("error"), JString!(")")),
481+
CloseSquareBracket => JArray!(JString!("error"), JString!("]")),
482+
CloseCurlyBracket => JArray!(JString!("error"), JString!("}")),
483483
}
484484
}
485485
}

0 commit comments

Comments
 (0)