diff options
author | Aleksey Kladov <[email protected]> | 2017-12-31 14:54:33 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2017-12-31 14:54:33 +0000 |
commit | 9ce4db545efba697f20ab5cecbefc0589c7146ca (patch) | |
tree | ecda02126426b473bf2f70777a148e569c114c98 /tests | |
parent | 98a58bf806ffda1b4d3352ed0f3e494fa25c8c74 (diff) |
Parser: groundwork
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lexer.rs | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/tests/lexer.rs b/tests/lexer.rs index 6a9bab66b..beca19c24 100644 --- a/tests/lexer.rs +++ b/tests/lexer.rs | |||
@@ -7,7 +7,7 @@ use std::path::{PathBuf, Path}; | |||
7 | use std::fs::read_dir; | 7 | use std::fs::read_dir; |
8 | use std::fmt::Write; | 8 | use std::fmt::Write; |
9 | 9 | ||
10 | use libsyntax2::{Token, next_token}; | 10 | use libsyntax2::{Token, tokenize}; |
11 | 11 | ||
12 | #[test] | 12 | #[test] |
13 | fn lexer_tests() { | 13 | fn lexer_tests() { |
@@ -53,18 +53,6 @@ fn lexer_test_case(path: &Path) { | |||
53 | assert_diff!(expected, actual, "\n", 0) | 53 | assert_diff!(expected, actual, "\n", 0) |
54 | } | 54 | } |
55 | 55 | ||
56 | fn tokenize(text: &str) -> Vec<Token> { | ||
57 | let mut text = text; | ||
58 | let mut acc = Vec::new(); | ||
59 | while !text.is_empty() { | ||
60 | let token = next_token(text); | ||
61 | acc.push(token); | ||
62 | let len: u32 = token.len.into(); | ||
63 | text = &text[len as usize..]; | ||
64 | } | ||
65 | acc | ||
66 | } | ||
67 | |||
68 | fn dump_tokens(tokens: &[Token], text: &str) -> String { | 56 | fn dump_tokens(tokens: &[Token], text: &str) -> String { |
69 | let mut acc = String::new(); | 57 | let mut acc = String::new(); |
70 | let mut offset = 0; | 58 | let mut offset = 0; |