From 766f801e12a85ccfa1b46c1fb701e1d3756b7626 Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Sat, 18 Dec 2021 13:42:00 -0500 Subject: [PATCH] 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` --- Makefile | 15 +++++++++++++++ test/big.html | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/big.txt | 24 ++++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 test/big.html create mode 100644 test/big.txt diff --git a/Makefile b/Makefile index 4d22fc8..d2aaa40 100644 --- 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 new file mode 100644 index 0000000..9c39953 --- /dev/null +++ b/test/big.html @@ -0,0 +1,58 @@ +

hello world

+ +

+This is an example blag file! +

+ +

Sub Header 2

+ +

Woah a third header?

+ + + + +

+This is a new paragraph +that wraps nicely +

+ + +
    +
  1. +This is a numbered list +
  2. +
  3. +Cool, huh? +
      +
    1. +yes! +
    2. +
    + +
  4. +
+ +

+This is a paragraph dangit with +links to https://alexkarle.com and +my gopherhole. +

diff --git a/test/big.txt b/test/big.txt new file mode 100644 index 0000000..3327f52 --- /dev/null +++ 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]. -- libgit2 1.1.1