aboutsummaryrefslogtreecommitdiff
path: root/tests/lexer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lexer.rs')
-rw-r--r--tests/lexer.rs28
1 files changed, 0 insertions, 28 deletions
diff --git a/tests/lexer.rs b/tests/lexer.rs
deleted file mode 100644
index 46ac9fedd..000000000
--- a/tests/lexer.rs
+++ /dev/null
@@ -1,28 +0,0 @@
1extern crate libsyntax2;
2extern crate testutils;
3
4use std::fmt::Write;
5
6use libsyntax2::{tokenize, Token};
7use testutils::dir_tests;
8
9#[test]
10fn lexer_tests() {
11 dir_tests(&["lexer"], |text| {
12 let tokens = tokenize(text);
13 dump_tokens(&tokens, text)
14 })
15}
16
17fn dump_tokens(tokens: &[Token], text: &str) -> String {
18 let mut acc = String::new();
19 let mut offset = 0;
20 for token in tokens {
21 let len: u32 = token.len.into();
22 let len = len as usize;
23 let token_text = &text[offset..offset + len];
24 offset += len;
25 write!(acc, "{:?} {} {:?}\n", token.kind, token.len, token_text).unwrap()
26 }
27 acc
28}