Skip to content

Commit 2835882

Browse files
committed
tests: add tests for dots
1 parent 41de07e commit 2835882

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/tokenizer.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,4 +356,42 @@ mod tests {
356356
])
357357
);
358358
}
359+
360+
#[test]
361+
fn test_dots() {
362+
assert_eq!(
363+
tokenize("{1..3}"),
364+
Ok(vec![
365+
Token::OBra(0),
366+
Token::Number("1".to_owned(), 1),
367+
Token::Range(2),
368+
Token::Number("3".to_owned(), 4),
369+
Token::CBra(5),
370+
])
371+
);
372+
assert_eq!(
373+
tokenize("{1.2.3,b}"),
374+
Ok(vec![
375+
Token::OBra(0),
376+
Token::Number("1".to_owned(), 1),
377+
Token::Text(".".to_owned(), 2),
378+
Token::Number("2".to_owned(), 3),
379+
Token::Text(".".to_owned(), 4),
380+
Token::Number("3".to_owned(), 5),
381+
Token::Comma(6),
382+
Token::Text("b".to_owned(), 7),
383+
Token::CBra(8),
384+
])
385+
);
386+
assert_eq!(
387+
tokenize("{a.b.c,d}"),
388+
Ok(vec![
389+
Token::OBra(0),
390+
Token::Text("a.b.c".to_owned(), 1),
391+
Token::Comma(6),
392+
Token::Text("d".to_owned(), 7),
393+
Token::CBra(8),
394+
])
395+
);
396+
}
359397
}

0 commit comments

Comments
 (0)