Skip to content

Commit ea0ddd6

Browse files
committed
AX_AT_DIFF_*(): add RUN-IF-(FAIL|PASS) support
Extend `AX_AT_DIFF_PATTERN()` and `AX_AT_DIFF_PYRE()` to support optional `RUN-IF-FAIL` and `RUN-IF-PASS` arguments.
1 parent 0ad2c9d commit ea0ddd6

File tree

5 files changed

+50
-5
lines changed

5 files changed

+50
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## [19] - unreleased
4+
5+
### Changed
6+
- Extend `AX_AT_DIFF_PATTERN()` and `AX_AT_DIFF_PYRE()` to support
7+
- optional `RUN-IF-FAIL` and `RUN-IF-PASS` arguments.
8+
39
## [18] - 2024-03-12
410

511
### Added

src/ax_at_check_pattern.m4

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SYNOPSIS
22
#
33
# AX_AT_CHECK_PATTERN(COMMANDS, [STATUS], [STDOUT-RE], [STDERR-RE], [RUN-IF-FAIL], [RUN-IF-PASS])
4-
# AX_AT_DIFF_PATTERN(PATTERN-FILE, TEST-FILE, [STATUS=0], [DIFFERENCES])
4+
# AX_AT_DIFF_PATTERN(PATTERN-FILE, TEST-FILE, [STATUS=0], [DIFFERENCES], [RUN-IF-FAIL], [RUN-IF-PASS])
55
# AX_AT_DATA_CHECK_PATTERN_AWK(FILENAME)
66
#
77
# DESCRIPTION
@@ -33,7 +33,7 @@
3333
#
3434
# LICENSE
3535
#
36-
# Copyright (c) 2013-2023, Luke Mewburn <[email protected]>
36+
# Copyright (c) 2013-2024, Luke Mewburn <[email protected]>
3737
#
3838
# Copying and distribution of this file, with or without modification,
3939
# are permitted in any medium without royalty provided the copyright
@@ -154,7 +154,7 @@ AT_CHECK(m4_expand([$1]), [$2], m4_expand([$3]), m4_expand([$4]),
154154

155155
m4_defun([AX_AT_DIFF_PATTERN], [dnl
156156
AS_REQUIRE([_AX_AT_CHECK_PATTERN_PREPARE])
157-
AT_CHECK([ax_at_diff_pattern $1 $2], [$3], [$4])
157+
AT_CHECK([ax_at_diff_pattern $1 $2], [$3], m4_expand([$4]), [], m4_expand([$5]), m4_expand([$6]))
158158
])dnl AX_AT_DIFF_PATTERN
159159

160160

src/ax_at_check_pyrediff.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SYNOPSIS
22
#
33
# AX_AT_CHECK_PYREDIFF(COMMANDS, [STATUS], [STDOUT-RE], [STDERR-RE], [RUN-IF-FAIL], [RUN-IF-PASS])
4-
# AX_AT_DIFF_PYRE(PYRE-FILE, TEST-FILE, [STATUS=0], [DIFFERENCES])
4+
# AX_AT_DIFF_PYRE(PYRE-FILE, TEST-FILE, [STATUS=0], [DIFFERENCES], [RUN-IF-FAIL], [RUN-IF-PASS])
55
# AX_AT_DATA_PYREDIFF_PY(FILENAME)
66
#
77
# DESCRIPTION
@@ -247,7 +247,7 @@ AT_CHECK(m4_expand([$1]), [$2], m4_expand([$3]), m4_expand([$4]),
247247

248248
m4_defun([AX_AT_DIFF_PYRE], [dnl
249249
AS_REQUIRE([_AX_AT_CHECK_PYRE_PREPARE])
250-
AT_CHECK([ax_at_diff_pyre $1 $2], [$3], [$4])
250+
AT_CHECK([ax_at_diff_pyre $1 $2], [$3], m4_expand([$4]), [], [$5], [$6])
251251
])dnl AX_AT_DIFF_PYRE
252252

253253

tests/02-trivial.at

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,14 @@ c
2222
])
2323

2424
AT_CHECK([echo ab; echo c], [0], [stdout])
25+
2526
AX_AT_DIFF_PATTERN([02.re], [stdout])
2627

28+
pass=false
29+
AX_AT_DIFF_PATTERN([02.re], [stdout], [0], [],
30+
[echo unexpected mismatch], [pass=true])
31+
AT_CHECK([if $pass; then exit 0; else exit 99; fi])
32+
2733

2834
dnl
2935
dnl PYRE checks
@@ -42,6 +48,12 @@ c
4248
AT_CHECK([if $pass; then exit 0; else exit 99; fi])
4349

4450
AT_CHECK([echo ab; echo c], [0], [stdout])
51+
4552
AX_AT_DIFF_PYRE([02.re], [stdout])
4653

54+
pass=false
55+
AX_AT_DIFF_PYRE([02.re], [stdout], [0], [],
56+
[echo unexpected mismatch], [pass=true])
57+
AT_CHECK([if $pass; then exit 0; else exit 99; fi])
58+
4759
AT_CLEANUP()

tests/04-trivial-bad.at

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,45 @@ dnl
44
dnl Also exercises RUN-IF-FAIL and RUN-IF-PASS support.
55
dnl
66

7+
dnl
8+
dnl PATTERN checks
9+
dnl
10+
711
AX_AT_CHECK_PATTERN([echo ab; echo c], [0], [dnl
812
ab?c?
913
C
1014
], [],
1115
[echo expected mismatch;at_failed=false],
1216
[echo unexpected match;at_failed=:])
1317

18+
AT_DATA([04.re], [dnl
19+
ab?c?
20+
C
21+
])
22+
23+
AT_CHECK([echo ab; echo c], [0], [stdout])
24+
25+
AX_AT_DIFF_PATTERN([04.re], [stdout], [0], [],
26+
[echo expected mismatch;at_failed=false],
27+
[echo unexpected match;at_failed=:])
28+
29+
30+
dnl
31+
dnl PYRE checks
32+
dnl
33+
1434
AX_AT_CHECK_PYREDIFF([echo ab; echo c], [0], [dnl
1535
ab?d?
1636
C
1737
], [],
1838
[echo expected mismatch;at_failed=false],
1939
[echo unexpected match;at_failed=:])
2040

41+
AT_CHECK([echo ab; echo c], [0], [stdout])
42+
43+
AX_AT_DIFF_PYRE([04.re], [stdout], [0], [],
44+
[echo expected mismatch;at_failed=false],
45+
[echo unexpected match;at_failed=:])
46+
47+
2148
AT_CLEANUP()

0 commit comments

Comments
 (0)