swc/common/tests/spanned_attr.rs
강동윤 11d056c777
Extract FromVariant (#586)
Move FromVariant to a separate crate
2020-01-15 18:00:08 +09:00

20 lines
355 B
Rust

use swc_common::{BytePos, Span, Spanned};
#[test]
fn lo_hi() {
#[derive(Spanned)]
struct LoHi {
#[span(lo)]
pub lo: BytePos,
#[span(hi)]
pub hi: BytePos,
}
let lo = BytePos(0);
let hi = BytePos(5);
assert_eq!(
LoHi { lo, hi }.span(),
Span::new(lo, hi, Default::default())
);
}