|
|
@ -31,8 +31,7 @@ mod test { |
|
|
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
#[test] |
|
|
|
fn chained_comments() { |
|
|
|
fn chained_comments() { |
|
|
|
let text = "/* this is one comment */ |
|
|
|
let text = "/* this is one comment */\n// And this is another"; |
|
|
|
// And this is another";
|
|
|
|
|
|
|
|
let parse = Foam::parse(Rule::file, text); |
|
|
|
let parse = Foam::parse(Rule::file, text); |
|
|
|
assert!(parse.is_ok(), "{:?}", parse); |
|
|
|
assert!(parse.is_ok(), "{:?}", parse); |
|
|
|
} |
|
|
|
} |
|
|
@ -69,14 +68,7 @@ mod test { |
|
|
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
#[test] |
|
|
|
fn dictionary() { |
|
|
|
fn dictionary() { |
|
|
|
let text = "FoamFile |
|
|
|
let text = "FoamFile\n{\nversion 2.0;\nformat ascii;\nclass dictionary;\nlocation system;\nobject caseSetupDict;\n}"; |
|
|
|
{ |
|
|
|
|
|
|
|
version 2.0; |
|
|
|
|
|
|
|
format ascii; |
|
|
|
|
|
|
|
class dictionary; |
|
|
|
|
|
|
|
location system; |
|
|
|
|
|
|
|
object caseSetupDict; |
|
|
|
|
|
|
|
}"; |
|
|
|
|
|
|
|
let parse = Foam::parse(Rule::dictionary, text); |
|
|
|
let parse = Foam::parse(Rule::dictionary, text); |
|
|
|
assert!(parse.is_ok(), "{:#?}", parse); |
|
|
|
assert!(parse.is_ok(), "{:#?}", parse); |
|
|
|
} |
|
|
|
} |
|
|
@ -85,6 +77,20 @@ mod test { |
|
|
|
fn dict_in_dict() { |
|
|
|
fn dict_in_dict() { |
|
|
|
let text = "dict1 { dict2 { class bad; } }"; |
|
|
|
let text = "dict1 { dict2 { class bad; } }"; |
|
|
|
let parse = Foam::parse(Rule::dictionary, text); |
|
|
|
let parse = Foam::parse(Rule::dictionary, text); |
|
|
|
assert!(parse.is_err(), "{:#?}", parse); |
|
|
|
assert!(parse.is_ok(), "{:#?}", parse); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
|
|
|
|
fn list() { |
|
|
|
|
|
|
|
let text = "list_name ( 1 2 3 );"; |
|
|
|
|
|
|
|
let parse = Foam::parse(Rule::list, text); |
|
|
|
|
|
|
|
assert!(parse.is_ok(), "{:#?}", parse); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
|
|
|
|
fn sized_list() { |
|
|
|
|
|
|
|
let text = "list_name 3 ( 1 2 3 );"; |
|
|
|
|
|
|
|
let parse = Foam::parse(Rule::list, text); |
|
|
|
|
|
|
|
assert!(parse.is_ok(), "{:#?}", parse); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|