std: Add tests for json decoding options
This commit is contained in:
parent
c9188c8301
commit
b10b8c3ee4
2 changed files with 42 additions and 13 deletions
|
@ -326,19 +326,30 @@ mod test {
|
|||
@~"fn foo (x : int) { x; }",
|
||||
~[],
|
||||
new_parse_sess(None));
|
||||
assert_eq!(to_json_str(@tts),
|
||||
~"[[\"tt_tok\",[null,[\"IDENT\",[\"fn\",false]]]],\
|
||||
[\"tt_tok\",[null,[\"IDENT\",[\"foo\",false]]]],\
|
||||
[\"tt_delim\",[[[\"tt_tok\",[null,[\"LPAREN\",[]]]],\
|
||||
[\"tt_tok\",[null,[\"IDENT\",[\"x\",false]]]],\
|
||||
[\"tt_tok\",[null,[\"COLON\",[]]]],\
|
||||
[\"tt_tok\",[null,[\"IDENT\",[\"int\",false]]]],\
|
||||
[\"tt_tok\",[null,[\"RPAREN\",[]]]]]]],\
|
||||
[\"tt_delim\",[[[\"tt_tok\",[null,[\"LBRACE\",[]]]],\
|
||||
[\"tt_tok\",[null,[\"IDENT\",[\"x\",false]]]],\
|
||||
[\"tt_tok\",[null,[\"SEMI\",[]]]],\
|
||||
[\"tt_tok\",[null,[\"RBRACE\",[]]]]]]]]"
|
||||
);
|
||||
assert_eq!(
|
||||
to_json_str(@tts),
|
||||
~"[\
|
||||
[\"tt_tok\",[null,[\"IDENT\",[\"fn\",false]]]],\
|
||||
[\"tt_tok\",[null,[\"IDENT\",[\"foo\",false]]]],\
|
||||
[\"tt_delim\",[\
|
||||
[\
|
||||
[\"tt_tok\",[null,[\"LPAREN\",[]]]],\
|
||||
[\"tt_tok\",[null,[\"IDENT\",[\"x\",false]]]],\
|
||||
[\"tt_tok\",[null,[\"COLON\",[]]]],\
|
||||
[\"tt_tok\",[null,[\"IDENT\",[\"int\",false]]]],\
|
||||
[\"tt_tok\",[null,[\"RPAREN\",[]]]]\
|
||||
]\
|
||||
]],\
|
||||
[\"tt_delim\",[\
|
||||
[\
|
||||
[\"tt_tok\",[null,[\"LBRACE\",[]]]],\
|
||||
[\"tt_tok\",[null,[\"IDENT\",[\"x\",false]]]],\
|
||||
[\"tt_tok\",[null,[\"SEMI\",[]]]],\
|
||||
[\"tt_tok\",[null,[\"RBRACE\",[]]]]\
|
||||
]\
|
||||
]]\
|
||||
]"
|
||||
);
|
||||
let ast1 = new_parser_from_tts(new_parse_sess(None),~[],tts)
|
||||
.parse_item(~[]);
|
||||
let ast2 = parse_item_from_source_str(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue