From d0900b3ca7be669418e185c0eea0d92550d83d4d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 6 Jan 2018 17:16:00 +0300 Subject: G: struct fields --- tests/data/parser/0002_struct_item_field.rs | 3 +++ tests/data/parser/0002_struct_item_field.txt | 15 +++++++++++++++ tests/parser.rs | 3 ++- 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tests/data/parser/0002_struct_item_field.rs create mode 100644 tests/data/parser/0002_struct_item_field.txt (limited to 'tests') diff --git a/tests/data/parser/0002_struct_item_field.rs b/tests/data/parser/0002_struct_item_field.rs new file mode 100644 index 000000000..cc3866d25 --- /dev/null +++ b/tests/data/parser/0002_struct_item_field.rs @@ -0,0 +1,3 @@ +struct S { + foo: u32 +} \ No newline at end of file diff --git a/tests/data/parser/0002_struct_item_field.txt b/tests/data/parser/0002_struct_item_field.txt new file mode 100644 index 000000000..b1673ade3 --- /dev/null +++ b/tests/data/parser/0002_struct_item_field.txt @@ -0,0 +1,15 @@ +FILE@[0; 25) + STRUCT_ITEM@[0; 25) + STRUCT_KW@[0; 6) + WHITESPACE@[6; 7) + IDENT@[7; 8) + WHITESPACE@[8; 9) + L_CURLY@[9; 10) + STRUCT_FIELD@[10; 24) + WHITESPACE@[10; 15) + IDENT@[15; 18) + COLON@[18; 19) + WHITESPACE@[19; 20) + IDENT@[20; 23) + WHITESPACE@[23; 24) + R_CURLY@[24; 25) \ No newline at end of file diff --git a/tests/parser.rs b/tests/parser.rs index e71b48852..5c63be3be 100644 --- a/tests/parser.rs +++ b/tests/parser.rs @@ -61,7 +61,8 @@ fn dump_tree(file: &File) -> String { fn go(node: Node, buff: &mut String, level: usize) { buff.push_str(&String::from(" ").repeat(level)); - write!(buff, "{:?}\n", node); + write!(buff, "{:?}\n", node) + .unwrap(); for child in node.children() { go(child, buff, level + 1) } -- cgit v1.2.3