Arg counts are leaking somehow

This commit is contained in:
Roberto Alsina 2023-07-14 17:43:13 -03:00
parent 4dc22ff2da
commit de4e072c97
2 changed files with 158 additions and 144 deletions

View File

@ -36,16 +36,7 @@ describe "Shortcodes" do
input[result.errors[0].position, 3].should eq ">}}" input[result.errors[0].position, 3].should eq ">}}"
end end
it "should accept mismatched brackets inside data are ok" do it "foo should accept mismatched brackets in qvals" do
input = "foobar {{% sc %}} >}}blah {{% /sc %}} "
result = parse(input)
result.shortcodes.size.should eq 1
result.errors.size.should eq 0
result.shortcodes[0].whole.should eq "{{% sc %}} >}}blah {{% /sc %}}"
result.shortcodes[0].data.should eq " >}}blah "
end
it "should accept mismatched brackets in qvals" do
input = "foobar {{% sc \">}}blah\" %}} {{% /sc %}}" input = "foobar {{% sc \">}}blah\" %}} {{% /sc %}}"
result = parse(input) result = parse(input)
result.shortcodes.size.should eq 1 result.shortcodes.size.should eq 1
@ -55,6 +46,18 @@ describe "Shortcodes" do
result.shortcodes[0].args[0].@value.should eq ">}}blah" result.shortcodes[0].args[0].@value.should eq ">}}blah"
end end
it "foo should accept mismatched brackets inside data are ok" do
input = "foobar {{% sc %}} >}}blah {{% /sc %}} "
result = parse(input)
result.shortcodes.size.should eq 1
result.errors.size.should eq 0
result.shortcodes[0].whole.should eq "{{% sc %}} >}}blah {{% /sc %}}"
result.shortcodes[0].data.should eq " >}}blah "
result.shortcodes[0].args.size.should eq 1
result.shortcodes[0].args[0].@value.should eq ">}}blah"
end
it "should consider spaces in shortcodes optional" do it "should consider spaces in shortcodes optional" do
input = "foobar {{% shortcode%}}blah" input = "foobar {{% shortcode%}}blah"
result = parse(input) result = parse(input)
@ -125,12 +128,11 @@ describe "Shortcodes" do
result.shortcodes[0].whole.should eq "{{% shortcode foo \"bar\" 42 bat=v1 baz=\"v2\" %}}" result.shortcodes[0].whole.should eq "{{% shortcode foo \"bar\" 42 bat=v1 baz=\"v2\" %}}"
end end
# // BUG? # BUG?
# // Ensure(parse, escaped_shortcode) # it "should ignore escaped shortcodes" do
# // { # input = "foobar \\{{% shortcode %}}blah"
# // char *input = "foobar \\{{% shortcode %}}"; # result = parse(input)
# // result = parse(input); # result.shortcodes.size.should eq 0
# // // No shortcodes # result.errors.size.should eq 0
# // assert_that(result.sc[0].name.len, is_equal_to(0)); # end
# // }
end end

File diff suppressed because it is too large Load Diff