Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make/unit-tests make(1): add tests for parsing direc...
details: https://anonhg.NetBSD.org/src/rev/0c9604b6d5e5
branches: trunk
changeset: 974302:0c9604b6d5e5
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Jul 27 20:46:17 2020 +0000
description:
make(1): add tests for parsing directives like .if and .info
diffstat:
distrib/sets/lists/tests/mi | 4 +-
usr.bin/make/unit-tests/Makefile | 3 +-
usr.bin/make/unit-tests/directives.exp | 30 ++++++++
usr.bin/make/unit-tests/directives.mk | 123 +++++++++++++++++++++++++++++++++
4 files changed, 158 insertions(+), 2 deletions(-)
diffs (196 lines):
diff -r 114bdc1abb81 -r 0c9604b6d5e5 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Mon Jul 27 20:45:15 2020 +0000
+++ b/distrib/sets/lists/tests/mi Mon Jul 27 20:46:17 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.879 2020/07/27 18:51:03 rillig Exp $
+# $NetBSD: mi,v 1.880 2020/07/27 20:46:18 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -4534,6 +4534,8 @@
./usr/tests/usr.bin/make/unit-tests/cond1.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/cond2.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/cond2.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/directives.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/directives.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/dollar.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/dollar.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/doterror.exp tests-usr.bin-tests compattestfile,atf
diff -r 114bdc1abb81 -r 0c9604b6d5e5 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile Mon Jul 27 20:45:15 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile Mon Jul 27 20:46:17 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.69 2020/07/27 19:45:56 rillig Exp $
+# $NetBSD: Makefile,v 1.70 2020/07/27 20:46:17 rillig Exp $
#
# Unit tests for make(1)
#
@@ -36,6 +36,7 @@
TESTS+= cond-short
TESTS+= cond1
TESTS+= cond2
+TESTS+= directives
TESTS+= dollar
TESTS+= doterror
TESTS+= dotwait
diff -r 114bdc1abb81 -r 0c9604b6d5e5 usr.bin/make/unit-tests/directives.exp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/directives.exp Mon Jul 27 20:46:17 2020 +0000
@@ -0,0 +1,30 @@
+make: "directives.mk" line 10: begin .export tests
+make: "directives.mk" line 11: Unknown directive
+make: "directives.mk" line 20: begin .export-env tests
+make: "directives.mk" line 30: begin .export-literal tests
+make: "directives.mk" line 40: begin .info tests
+make: "directives.mk" line 41: Unknown directive
+make: "directives.mk" line 42: Unknown directive
+make: "directives.mk" line 43: message
+make: "directives.mk" line 44: indented message
+make: "directives.mk" line 45: Unknown directive
+make: "directives.mk" line 46: message
+make: "directives.mk" line 50: begin .undef tests
+make: "directives.mk" line 51: Unknown directive
+make: "directives.mk" line 60: begin .unexport tests
+make: "directives.mk" line 61: Unknown directive
+make: "directives.mk" line 70: begin .unexport-env tests
+make: "directives.mk" line 80: begin .warning tests
+make: "directives.mk" line 81: Unknown directive
+make: "directives.mk" line 82: Unknown directive
+make: "directives.mk" line 83: Unknown directive
+make: "directives.mk" line 84: warning: message
+make: "directives.mk" line 85: Unknown directive
+make: "directives.mk" line 86: warning: messages
+make: "directives.mk" line 90: begin .elif misspellings tests, part 1
+make: "directives.mk" line 100: begin .elif misspellings tests, part 2
+make: "directives.mk" line 110: begin .elif misspellings tests, part 3
+make: "directives.mk" line 120: end of the tests
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
diff -r 114bdc1abb81 -r 0c9604b6d5e5 usr.bin/make/unit-tests/directives.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/directives.mk Mon Jul 27 20:46:17 2020 +0000
@@ -0,0 +1,123 @@
+# $NetBSD: directives.mk,v 1.1 2020/07/27 20:46:17 rillig Exp $
+#
+# Tests for parsing directives, in the same order as in the manual page.
+#
+# Each test group has 10 lines, to keep the expected file stable.
+#
+# no tests for .error since it exits immediately, see ParseMessage.
+
+
+.info begin .export tests
+.expor # misspelled
+.export # oops: missing argument
+.export VARNAME
+.exporting works # oops: misspelled
+
+
+
+
+
+.info begin .export-env tests
+.export-en # oops: misspelled
+.export-env
+.export-environment # oops: misspelled
+
+
+
+
+
+
+.info begin .export-literal tests
+.export-litera # oops: misspelled
+.export-literal # oops: missing argument
+.export-literal VARNAME
+.export-literally # oops: misspelled
+
+
+
+
+
+.info begin .info tests
+.inf # misspelled
+.info # oops: message should be "missing parameter"
+.info message
+.info indented message
+.information
+.information message # oops: misspelled
+
+
+
+.info begin .undef tests
+.unde # misspelled
+.undef # oops: missing argument
+.undefined # oops: misspelled
+.undef VARNAME
+
+
+
+
+
+.info begin .unexport tests
+.unexpor # misspelled
+.unexport # oops: missing argument
+.unexport VARNAME # ok
+.unexporting works # oops: misspelled
+
+
+
+
+
+.info begin .unexport-env tests
+.unexport-en # misspelled
+.unexport-env # ok
+.unexport-environment # oops: misspelled
+
+
+
+
+
+
+.info begin .warning tests
+.warn # misspelled
+.warnin # misspelled
+.warning # oops: should be "missing argument"
+.warning message # ok
+.warnings # misspelled
+.warnings messages # oops
+
+
+
+.info begin .elif misspellings tests, part 1
+.if 1
+.elif 1 # ok
+.elsif 1 # oops: misspelled
+.elseif 1 # oops: misspelled
+.endif
+
+
+
+
+.info begin .elif misspellings tests, part 2
+.if 0
+.elif 0 # ok
+.elsif 0 # oops: misspelled
+.elseif 0 # oops: misspelled
+.endif
+
+
+
+
+.info begin .elif misspellings tests, part 3
+.if 0
+.elsif 0 # oops: misspelled
+.endif
+.if 0
+.elseif 0 # oops: misspelled
+.endif
+
+
+
+.info end of the tests
+
+all:
+ @:
Home |
Main Index |
Thread Index |
Old Index