commit 766f801e12a85ccfa1b46c1fb701e1d3756b7626 (patch)
parent cd140950d7d4f0f22ed9d9dbeddac89ed423bbdf
Author: Alex Karle <alex@alexkarle.com>
Date: Sat, 18 Dec 2021 13:42:00 -0500
test: Add very first test case, with check recipe
I'll be using the classic "baseline" approach. Regenerate the tests
with `make check GENBASE=1`, check with `make check`
Diffstat:
3 files changed, 97 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
@@ -4,6 +4,21 @@ CFLAGS = -g -O2 -Wall -Wpedantic -Wextra
blag: blag.c
$(CC) $(CFLAGS) -o $@ blag.c
+.PHONY: check
+check: blag
+ @for f in test/*.txt; do \
+ printf "$$f ... "; \
+ base=$$(basename $$f txt)html; \
+ if [ -z $(GENBASE) ]; then \
+ ./blag < $$f > /tmp/$$base; \
+ diff -u test/$$base /tmp/$$base; \
+ echo "success!"; \
+ else \
+ ./blag < $$f > test/$$base; \
+ echo "generated!"; \
+ fi; \
+ done
+
.PHONY: clean
clean:
rm -f blag
diff --git a/test/big.html b/test/big.html
@@ -0,0 +1,58 @@
+<h1>hello world</h1>
+
+<p>
+This is an example blag file!
+</p>
+
+<h2>Sub Header 2</h2>
+
+<h3>Woah a third header?</h3>
+
+
+<ul>
+<li>
+We can have lists??
+<ul>
+<li>
+And nested lists??
+</li>
+<li>
+And <code>code</code> within lists?
+</li>
+<li>
+but not <code>*bold*</code> within code
+</li>
+</ul>
+
+</li>
+<li>
+A tier1 item
+</li>
+</ul>
+
+<p>
+This is a new paragraph
+that wraps nicely
+</p>
+
+
+<ol>
+<li>
+This is a numbered list
+</li>
+<li>
+Cool, huh?
+<ol>
+<li>
+yes!
+</li>
+</ol>
+
+</li>
+</ol>
+
+<p>
+This is a <em>paragraph</em> <strong>dangit</strong> with
+links to <a href="https://alexkarle.com">https://alexkarle.com</a> and
+my <a href="gopher://alexkarle.com">gopherhole</a>.
+</p>
diff --git a/test/big.txt b/test/big.txt
@@ -0,0 +1,24 @@
+# hello world
+
+This is an example blag file!
+
+## Sub Header 2
+
+### Woah a third header?
+
+- We can have lists??
+ - And nested lists??
+ - And `code` within lists?
+ - but not `*bold*` within code
+- A tier1 item
+
+This is a new paragraph
+that wraps nicely
+
+1. This is a numbered list
+2. Cool, huh?
+ 1. yes!
+
+This is a _paragraph_ *dangit* with
+links to [https://alexkarle.com] and
+my [gopher://alexkarle.com gopherhole].