31 lines
820 B
Rust
31 lines
820 B
Rust
|
use frostwalker::lexer::{self, Token, Class};
|
||
|
use frostwalker::validator;
|
||
|
|
||
|
#[test]
|
||
|
fn lv_single_key() {
|
||
|
let tree = lexer::tokenize("key = \"value\"");
|
||
|
let result = validator::validate(&tree);
|
||
|
assert_eq!(result.is_none(), true);
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn lv_triple_key() {
|
||
|
let tree = lexer::tokenize("key = \"value\"\r\nkey1 = 128\nkey2 = [ 6, 7 ]");
|
||
|
let result = validator::validate(&tree);
|
||
|
assert_eq!(result.is_none(), true);
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn lv_triple_key_missing_newline() {
|
||
|
let tree = lexer::tokenize("key = \"value\"key1 = 128\nkey2 = [ 6, 7 ]");
|
||
|
let result = validator::validate(&tree);
|
||
|
assert_eq!(result.is_some(), true);
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn lv_double_equals() {
|
||
|
let tree = lexer::tokenize("key = = \"value\"\r\nkey1 = 128\nkey2 = [ 6, 7 ]");
|
||
|
let result = validator::validate(&tree);
|
||
|
assert_eq!(result.is_some(), true);
|
||
|
}
|