Skip to content

Commit c1cf0f8

Browse files
committed
Add test of Literal::subspan
1 parent e163e79 commit c1cf0f8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/test.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,12 @@ fn literal_parse() {
268268
fn literal_span() {
269269
let positive = "0.1".parse::<Literal>().unwrap();
270270
let negative = "-0.1".parse::<Literal>().unwrap();
271+
let subspan = positive.subspan(1..2);
271272

272273
#[cfg(not(span_locations))]
273274
{
274-
let _ = positive;
275275
let _ = negative;
276+
assert!(subspan.is_none());
276277
}
277278

278279
#[cfg(span_locations)]
@@ -281,7 +282,10 @@ fn literal_span() {
281282
assert_eq!(positive.span().end().column, 3);
282283
assert_eq!(negative.span().start().column, 0);
283284
assert_eq!(negative.span().end().column, 4);
285+
assert_eq!(subspan.unwrap().source_text().unwrap(), "."); // FIXME
284286
}
287+
288+
assert!(positive.subspan(1..4).is_none());
285289
}
286290

287291
#[test]

0 commit comments

Comments
 (0)