aboutsummaryrefslogtreecommitdiff
path: root/inline_parser.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-08-06 01:16:08 +0700
committerShulhan <ms@kilabit.info>2022-08-06 01:17:10 +0700
commit9fe1ecf6050bbebfe4096e5c41a1e711dd16190d (patch)
tree29e4593dffc64d5d34950a07b79d2339fb596910 /inline_parser.go
parent502ccd5e3f41f4fd1b3bfa1fad2c41785db1a7d1 (diff)
downloadasciidoctor-go-9fe1ecf6050bbebfe4096e5c41a1e711dd16190d.tar.xz
all: rewrite unit tests for inlineParser using test.Data
Using string literal for testing string input that may contains backtick or double quote make the test code become unreadable and hard to modify. The test.Data help this by moving the input and expected output into a file that can we write as is.
Diffstat (limited to 'inline_parser.go')
-rw-r--r--inline_parser.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/inline_parser.go b/inline_parser.go
index 62287bf..881374e 100644
--- a/inline_parser.go
+++ b/inline_parser.go
@@ -617,12 +617,16 @@ func (pi *inlineParser) parseFormat(kind int, style int64) bool {
el *element
idx int
+ prevc byte
+ nextc byte
hasEnd bool
)
_, idx = indexByteUnescape(raw, pi.c)
for idx >= 0 {
- var prevc, nextc byte
+ prevc = 0
+ nextc = 0
+
if idx > 0 {
prevc = raw[idx-1]
}