aboutsummaryrefslogtreecommitdiff
path: root/inline_parser_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-11-21 01:20:03 +0700
committerShulhan <ms@kilabit.info>2022-11-27 21:14:18 +0700
commit5c7bfc04dc3d2cd60e84c80229804fdcd615709e (patch)
tree63b9749699090421b55355d0f3e1f5c1b99875a1 /inline_parser_test.go
parent3d1caba74842d7dd0800cd0351ddb4c47364a541 (diff)
downloadasciidoctor-go-5c7bfc04dc3d2cd60e84c80229804fdcd615709e.tar.xz
all: implement inline macro for passthrough ("pass:")
The inline passthrough "pass:" can be used to control the substitutions applied to a run of text. Ref: https://docs.asciidoctor.org/asciidoc/latest/pass/pass-macro/
Diffstat (limited to 'inline_parser_test.go')
-rw-r--r--inline_parser_test.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/inline_parser_test.go b/inline_parser_test.go
index 0fd62bf..3670d7f 100644
--- a/inline_parser_test.go
+++ b/inline_parser_test.go
@@ -6,6 +6,7 @@ package asciidoctor
import (
"bytes"
"fmt"
+ "strings"
"testing"
"github.com/shuLhan/share/lib/test"
@@ -132,3 +133,50 @@ func TestInlineParser_macro_footnote(t *testing.T) {
got.Reset()
}
}
+
+func TestInlineParser_macro_pass(t *testing.T) {
+ var (
+ testFiles = []string{
+ `testdata/inline_parser/macro_pass_none_test.txt`,
+ `testdata/inline_parser/macro_pass_c_test.txt`,
+ `testdata/inline_parser/macro_pass_q_test.txt`,
+ `testdata/inline_parser/macro_pass_a_test.txt`,
+ `testdata/inline_parser/macro_pass_r_test.txt`,
+ `testdata/inline_parser/macro_pass_m_test.txt`,
+ }
+
+ testFile string
+ inputName string
+ outputName string
+ got bytes.Buffer
+ tdata *test.Data
+ doc *Document
+ exp []byte
+ err error
+ )
+
+ for _, testFile = range testFiles {
+ tdata, err = test.LoadData(testFile)
+ if err != nil {
+ t.Fatalf(`%s: %s`, testFile, err)
+ }
+
+ for inputName = range tdata.Input {
+ t.Logf(`%s: %s`, testFile, inputName)
+
+ outputName = strings.Replace(inputName, `.adoc`, `.html`, 1)
+
+ doc = Parse(tdata.Input[inputName])
+
+ got.Reset()
+ err = doc.ToHTMLEmbedded(&got)
+ if err != nil {
+ t.Fatalf(`%s: %s`, inputName, err)
+ }
+
+ exp = tdata.Output[outputName]
+
+ test.Assert(t, inputName, string(exp), got.String())
+ }
+ }
+}