diff options
| author | Shulhan <ms@kilabit.info> | 2022-12-19 22:52:09 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-12-19 22:53:42 +0700 |
| commit | d9582373ece2f5da42725e22bb90c5daa93316df (patch) | |
| tree | fd4142cb88d8e9466b6d82a3d8591e2e0c0765dc /document_test.go | |
| parent | 56de5ca1d10d422ad33a550bdb4e358130a7ff3c (diff) | |
| download | asciidoctor-go-d9582373ece2f5da42725e22bb90c5daa93316df.tar.xz | |
all: support multi line attribute values
If the attribute value end with backslash '\', the value continue to the
next line.
Diffstat (limited to 'document_test.go')
| -rw-r--r-- | document_test.go | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/document_test.go b/document_test.go index a6f60e7..42e9b03 100644 --- a/document_test.go +++ b/document_test.go @@ -4,6 +4,7 @@ package asciidoctor import ( + "bytes" "os" "testing" @@ -94,3 +95,49 @@ func TestParse_document_title(t *testing.T) { test.Assert(t, `String`, c.expString, got.Title.String()) } } + +func TestDocument_ToHTML(t *testing.T) { + type testCase struct { + name string + fileAdoc string + fileExpHtml string + } + + var ( + cases = []testCase{{ + name: `header`, + fileAdoc: `testdata/html/header.adoc`, + fileExpHtml: `testdata/html/header.exp.html`, + }} + + c testCase + doc *Document + err error + got bytes.Buffer + exp []byte + ) + + for _, c = range cases { + doc, err = Open(c.fileAdoc) + if err != nil { + t.Fatal(err) + } + + // Since we cannot overwrite the asciidoctor output for + // generator, we override ourself. + doc.Attributes[MetaNameGenerator] = `Asciidoctor 2.0.18` + + got.Reset() + + err = doc.ToHTML(&got) + if err != nil { + t.Fatal(err) + } + + exp, err = os.ReadFile(c.fileExpHtml) + if err != nil { + t.Fatal(err) + } + test.Assert(t, c.name, string(exp), got.String()) + } +} |
