Skip to content

Commit

Permalink
fix: Add coverage for a missing case of TInline::Span
Browse files Browse the repository at this point in the history
  • Loading branch information
scouten authored Nov 29, 2024
1 parent 69c49a1 commit 451e527
Showing 1 changed file with 52 additions and 3 deletions.
55 changes: 52 additions & 3 deletions src/tests/inlines/macro.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
use pretty_assertions_sorted::assert_eq;

use crate::{
inlines::InlineMacro,
tests::fixtures::{inlines::TInlineMacro, TSpan},
inlines::{Inline, InlineMacro},
span::HasSpan,
tests::fixtures::{
inlines::{TInline, TInlineMacro},
TSpan,
},
Span,
};

Expand Down Expand Up @@ -40,7 +44,7 @@ fn err_attr_list_not_closed() {
}

#[test]
fn simplest_block_macro() {
fn simplest_inline_macro() {
let mi = InlineMacro::parse(Span::new("foo:[]")).unwrap();

assert_eq!(
Expand Down Expand Up @@ -74,6 +78,51 @@ fn simplest_block_macro() {
);
}

#[test]
fn simplest_inline_macro_via_inline_parse() {
let mi = Inline::parse(Span::new("foo:[]")).unwrap();

assert_eq!(
mi.item,
TInline::Macro(TInlineMacro {
name: TSpan {
data: "foo",
line: 1,
col: 1,
offset: 0,
},
target: None,
attrlist: None,
source: TSpan {
data: "foo:[]",
line: 1,
col: 1,
offset: 0,
},
})
);

assert_eq!(
mi.after,
TSpan {
data: "",
line: 1,
col: 7,
offset: 6
}
);

assert_eq!(
mi.item.span(),
TSpan {
data: "foo:[]",
line: 1,
col: 1,
offset: 0,
}
);
}

#[test]
fn has_target() {
let mi = InlineMacro::parse(Span::new("foo:bar[]")).unwrap();
Expand Down

0 comments on commit 451e527

Please sign in to comment.