Skip to content

Commit c8ace54

Browse files
author
dkazankov
committed
ada-markdown-25: add test support
1 parent 179ef0b commit c8ace54

4 files changed

Lines changed: 52 additions & 6 deletions

File tree

textproc/ada-markdown-25/Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $NetBSD: Makefile,v 1.3 2025/09/09 07:25:11 dkazankov Exp $
1+
# $NetBSD: Makefile,v 1.4 2025/10/03 13:40:03 dkazankov Exp $
22

33
DISTNAME= ${GITHUB_PROJECT}-${PKGVERSION_NOREV}
44
PKGNAME= ${GITHUB_PROJECT}-${GNAT_NAME}-25.0.0
@@ -36,6 +36,14 @@ MAKE_FLAGS+= ALL_LIBRARY_TYPES=static
3636

3737
MAKE_FLAGS+= PREFIX=${GNAT_PREFIX} BUILD_MODE=prod
3838

39+
GITHUB_SUBMODULES+= commonmark commonmark-spec a0a91dd commonmark-spec
40+
41+
.if ${PKGSRC_RUN_TEST:tl} == "yes"
42+
.include "../../lang/python/tool.mk"
43+
.endif
44+
45+
TEST_TARGET= check
46+
3947
GENERATE_PLIST+= \
4048
cd ${DESTDIR}${PREFIX} && \
4149
${FIND} ${GNAT_PKGBASE} \( -type f -or -type l \) -print | ${SORT};

textproc/ada-markdown-25/distinfo

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
$NetBSD: distinfo,v 1.1 2025/09/07 07:42:08 dkazankov Exp $
1+
$NetBSD: distinfo,v 1.2 2025/10/03 13:40:03 dkazankov Exp $
22

3+
BLAKE2s (commonmark-commonmark-spec-a0a91dd.tar.gz) = 123864aa46f60917b60cfc18925060ef32bbc383cb1b7f3178034b085147b6f4
4+
SHA512 (commonmark-commonmark-spec-a0a91dd.tar.gz) = 879d75f3cf6da3a8466e5a3f74b2e64e5cf93715dd81af532e09d1cdebd4c5273eaf3d65d065a96238c8073d63b19ec1dd05f356c21b48248f43f44fbc087687
5+
Size (commonmark-commonmark-spec-a0a91dd.tar.gz) = 75536 bytes
36
BLAKE2s (markdown-25.0.0.tar.gz) = e66bcdd5fe88dfc6f4f45a8c3e404dda0d701683cd0e6eea99d741670fa13ed1
47
SHA512 (markdown-25.0.0.tar.gz) = 1818110a0539b91d407b1bba6ca2d9f18e0d5fe71be97dc9cd1000331e579a5f06349f4f1b11f09341e507dbff9e47cafb31df2d5816e33c1c84baa9e4b01009
58
Size (markdown-25.0.0.tar.gz) = 48445 bytes
6-
SHA1 (patch-Makefile) = 47588d3bd18c7afdc6f061391106fb7a1e26f93b
9+
SHA1 (patch-Makefile) = be2f7de12e629de10427daad6db7d0973c0a4850
10+
SHA1 (patch-commonmark-spec_test_normalize.py) = fec7d381a1370a161ee3d4a8521e08d023a620fc

textproc/ada-markdown-25/patches/patch-Makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
$NetBSD: patch-Makefile,v 1.1 2025/09/07 07:42:08 dkazankov Exp $
1+
$NetBSD: patch-Makefile,v 1.2 2025/10/03 13:40:04 dkazankov Exp $
22

33
Make BUILD_MODE externally settable
44
Add ALL_LIBRARY_TYPES to build several libraries
55
Add options for gprbuild and gprinstall
66
Fix GPRINSTALL parameters
7+
Remove test specs download
78

89
--- Makefile.orig 2024-05-04 22:43:19.000000000 +0300
910
+++ Makefile
@@ -17,7 +18,7 @@ Fix GPRINSTALL parameters
1718

1819
GPRBUILD_FLAGS = -p -j0 -XBUILD_MODE=$(BUILD_MODE)
1920
PREFIX ?= /usr
20-
@@ -26,10 +27,24 @@
21+
@@ -26,17 +27,31 @@
2122
.PHONY: spellcheck check
2223

2324
all:
@@ -43,4 +44,13 @@ Fix GPRINSTALL parameters
4344
+ done;
4445

4546
build_tests: all
46-
gprbuild $(GPRBUILD_FLAGS) -aP gnat -P gnat/tests/commonmark_tests.gpr
47+
- gprbuild $(GPRBUILD_FLAGS) -aP gnat -P gnat/tests/commonmark_tests.gpr
48+
+ gprbuild $(GPRBUILD_FLAGS) -aP gnat -P gnat/tests/commonmark_tests.gpr $(GPRBUILD_OPTIONS)
49+
50+
check: build_tests check_markdown
51+
52+
-check_markdown: commonmark-spec
53+
+check_markdown:
54+
cd commonmark-spec; python3 test/spec_tests.py --program ../.objs/static/tests/commonmark_tests |\
55+
grep -E "^Example|^[0-9]+.passed" |\
56+
tee markdown_tests_result | tail
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
$NetBSD: patch-commonmark-spec_test_normalize.py,v 1.1 2025/10/03 13:40:04 dkazankov Exp $
2+
3+
Fix syntax warnings
4+
5+
--- commonmark-spec/test/normalize.py.orig 2025-09-16 23:53:08.000000000 +0300
6+
+++ commonmark-spec/test/normalize.py
7+
@@ -18,7 +18,7 @@
8+
# Normalization code, adapted from
9+
# https://github.com/karlcow/markdown-testsuite/
10+
significant_attrs = ["alt", "href", "src", "title"]
11+
-whitespace_re = re.compile('\s+')
12+
+whitespace_re = re.compile(r'\s+')
13+
class MyHTMLParser(HTMLParser):
14+
def __init__(self):
15+
HTMLParser.__init__(self)
16+
@@ -176,7 +176,7 @@
17+
'\u2200&><"'
18+
19+
"""
20+
- html_chunk_re = re.compile("(\<!\[CDATA\[.*?\]\]\>|\<[^>]*\>|[^<]+)")
21+
+ html_chunk_re = re.compile(r'(\<!\[CDATA\[.*?\]\]\>|\<[^>]*\>|[^<]+)')
22+
try:
23+
parser = MyHTMLParser()
24+
# We work around HTMLParser's limitations parsing CDATA

0 commit comments

Comments
 (0)