aboutsummaryrefslogtreecommitdiff
path: root/element_image_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-10-15 12:36:20 +0700
committerShulhan <ms@kilabit.info>2024-10-15 12:37:13 +0700
commit2ea376671b1975392252bc6f70497c54d4bbab16 (patch)
treee2f88ef4203c82e21d0b27e593dca92f18bfdf92 /element_image_test.go
parentc8eb463345633a1816f97cc967d104127cc4c5f4 (diff)
downloadasciidoctor-go-2ea376671b1975392252bc6f70497c54d4bbab16.tar.xz
all: group all image related method and functions into single file
This is to make it easy to see how it parsed and how it written to HTML, make the code more searchable. While at it, add test for block image.
Diffstat (limited to 'element_image_test.go')
-rw-r--r--element_image_test.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/element_image_test.go b/element_image_test.go
new file mode 100644
index 0000000..a548501
--- /dev/null
+++ b/element_image_test.go
@@ -0,0 +1,38 @@
+// SPDX-FileCopyrightText: 2024 M. Shulhan <ms@kilabit.info>
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+package asciidoctor
+
+import (
+ "bytes"
+ "testing"
+
+ "git.sr.ht/~shulhan/pakakeh.go/lib/test"
+)
+
+func TestElementParseBlockImage(t *testing.T) {
+ var (
+ tdata *test.Data
+ err error
+ )
+ tdata, err = test.LoadData(`testdata/element_image_test.txt`)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ var (
+ caseName string
+ input []byte
+ got bytes.Buffer
+ )
+ for caseName, input = range tdata.Input {
+ var doc = Parse(input)
+
+ got.Reset()
+ doc.ToHTMLEmbedded(&got)
+
+ var exp = string(tdata.Output[caseName])
+ test.Assert(t, caseName, exp, got.String())
+ }
+}