Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/xlint/lint2 tests/lint: add more tests for lint2



details:   https://anonhg.NetBSD.org/src/rev/782cb11ba63f
branches:  trunk
changeset: 1022788:782cb11ba63f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 07 19:07:03 2021 +0000

description:
tests/lint: add more tests for lint2

diffstat:

 tests/usr.bin/xlint/lint2/msg_001.exp |   4 ++--
 tests/usr.bin/xlint/lint2/msg_001.ln  |  20 +++++++++++++++++---
 tests/usr.bin/xlint/lint2/msg_003.exp |   2 ++
 tests/usr.bin/xlint/lint2/msg_003.ln  |  14 +++++++++++---
 tests/usr.bin/xlint/lint2/msg_004.exp |   6 ++++++
 tests/usr.bin/xlint/lint2/msg_004.ln  |  17 ++++++++++++++---
 tests/usr.bin/xlint/lint2/msg_005.exp |   6 ++++++
 tests/usr.bin/xlint/lint2/msg_005.ln  |  17 ++++++++++++++---
 tests/usr.bin/xlint/lint2/msg_006.exp |   6 ++++++
 tests/usr.bin/xlint/lint2/msg_006.ln  |  17 ++++++++++++++---
 tests/usr.bin/xlint/lint2/msg_011.exp |   6 ++++++
 tests/usr.bin/xlint/lint2/msg_011.ln  |  17 ++++++++++++++---
 tests/usr.bin/xlint/lint2/msg_012.exp |   1 +
 tests/usr.bin/xlint/lint2/msg_012.ln  |  14 +++++++++++---
 14 files changed, 124 insertions(+), 23 deletions(-)

diffs (229 lines):

diff -r 3d15f2c0c3e8 -r 782cb11ba63f tests/usr.bin/xlint/lint2/msg_001.exp
--- a/tests/usr.bin/xlint/lint2/msg_001.exp     Sat Aug 07 18:40:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint2/msg_001.exp     Sat Aug 07 19:07:03 2021 +0000
@@ -1,2 +1,2 @@
-defined_not_used defined( msg_000.c(2) ), but never used
-used_not_defined used( msg_000.c(3) ), but not defined
+defined_not_used defined( msg_001.c(2) ), but never used
+used_not_defined used( msg_001.c(3) ), but not defined
diff -r 3d15f2c0c3e8 -r 782cb11ba63f tests/usr.bin/xlint/lint2/msg_001.ln
--- a/tests/usr.bin/xlint/lint2/msg_001.ln      Sat Aug 07 18:40:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint2/msg_001.ln      Sat Aug 07 19:07:03 2021 +0000
@@ -1,11 +1,25 @@
-# $NetBSD: msg_001.ln,v 1.2 2021/08/06 16:21:00 rillig Exp $
+# $NetBSD: msg_001.ln,v 1.3 2021/08/07 19:07:03 rillig Exp $
 #
 # Test data for message 1 of lint2:
 #      %s defined( %s ), but never used
 #
 
-0smsg_000.c
-Smsg_000.c
+0smsg_001.c
+Smsg_001.c
 
 3c0.3p1i16used_not_definedf2IDI
 2d0.2do16defined_not_usedf0I
+
+# The function 'main' always counts as used.
+# int main(void) {}
+10d0.10d4mainF0I
+# extern main() {}
+12d0.12e4mainFI
+
+# If a function is declared once in old style and once with prototype,
+# the prototype definition is preferred; see chkname.
+#
+# extern merge_old_style_and_prototype();
+20d0.20e29merge_old_style_and_prototypeFI
+# extern int merge_old_style_and_prototype(char *);
+21d0.21e29merge_old_style_and_prototypeF1PCI
diff -r 3d15f2c0c3e8 -r 782cb11ba63f tests/usr.bin/xlint/lint2/msg_003.exp
--- a/tests/usr.bin/xlint/lint2/msg_003.exp     Sat Aug 07 18:40:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint2/msg_003.exp     Sat Aug 07 19:07:03 2021 +0000
@@ -0,0 +1,2 @@
+function defined( msg_003_a.c(10) ), but never used
+function multiply defined      msg_003_a.c(10)  ::  msg_003_b.c(10)
diff -r 3d15f2c0c3e8 -r 782cb11ba63f tests/usr.bin/xlint/lint2/msg_003.ln
--- a/tests/usr.bin/xlint/lint2/msg_003.ln      Sat Aug 07 18:40:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint2/msg_003.ln      Sat Aug 07 19:07:03 2021 +0000
@@ -1,6 +1,14 @@
-# $NetBSD: msg_003.ln,v 1.1 2021/08/05 22:36:08 rillig Exp $
+# $NetBSD: msg_003.ln,v 1.2 2021/08/07 19:07:03 rillig Exp $
 #
 # Test data for message 3 of lint2:
 #      %s multiply defined     %s  ::  %s
-#
-# TODO: add actual test data
+
+0smsg_003_a.c
+Smsg_003_a.c
+# msg_003_a.c:10: int function(void);
+10d0.10d8functionF0I
+
+0smsg_003_b.c
+Smsg_003_b.c
+# msg_003_b.c:10: int function(void);
+10d0.10d8functionF0I
diff -r 3d15f2c0c3e8 -r 782cb11ba63f tests/usr.bin/xlint/lint2/msg_004.exp
--- a/tests/usr.bin/xlint/lint2/msg_004.exp     Sat Aug 07 18:40:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint2/msg_004.exp     Sat Aug 07 19:07:03 2021 +0000
@@ -0,0 +1,6 @@
+add value used inconsistently          msg_004_define.c(2)  ::  msg_004_call.c(4)
+add value declared inconsistently (double != int)      msg_004_define.c(2)  ::  msg_004_call.c(2)
+add, arg 1 used inconsistently         msg_004_define.c(2)[double]  ::  msg_004_call.c(4)[int]
+add, arg 2 used inconsistently         msg_004_define.c(2)[double]  ::  msg_004_call.c(4)[int]
+add, arg 1 declared inconsistently (double != int)     msg_004_define.c(2) :: msg_004_call.c(2)
+add, arg 2 declared inconsistently (double != int)     msg_004_define.c(2) :: msg_004_call.c(2)
diff -r 3d15f2c0c3e8 -r 782cb11ba63f tests/usr.bin/xlint/lint2/msg_004.ln
--- a/tests/usr.bin/xlint/lint2/msg_004.ln      Sat Aug 07 18:40:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint2/msg_004.ln      Sat Aug 07 19:07:03 2021 +0000
@@ -1,6 +1,17 @@
-# $NetBSD: msg_004.ln,v 1.1 2021/08/05 22:36:08 rillig Exp $
+# $NetBSD: msg_004.ln,v 1.2 2021/08/07 19:07:03 rillig Exp $
 #
 # Test data for message 4 of lint2:
 #      %s value used inconsistently    %s  ::  %s
-#
-# TODO: add actual test data
+
+# msg_004_define.c:2: double add(double a, double b) { return a + b; }
+0smsg_004_define.c
+Smsg_004_define.c
+2d0.2dr3addF2DDD
+
+# msg_004_call.c:2: int add(int, int);
+# msg_004_call.c:4: int main(void) { return add(2, 3); }
+0smsg_004_call.c
+Smsg_004_call.c
+2d0.2e3addF2III
+4c0.4p1p2u3addf2III
+4d0.4dr4mainF0I
diff -r 3d15f2c0c3e8 -r 782cb11ba63f tests/usr.bin/xlint/lint2/msg_005.exp
--- a/tests/usr.bin/xlint/lint2/msg_005.exp     Sat Aug 07 18:40:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint2/msg_005.exp     Sat Aug 07 19:07:03 2021 +0000
@@ -0,0 +1,6 @@
+add value used inconsistently          msg_005_define.c(2)  ::  msg_005_call.c(4)
+add value declared inconsistently (double != int)      msg_005_define.c(2)  ::  msg_005_call.c(2)
+add, arg 1 used inconsistently         msg_005_define.c(2)[double]  ::  msg_005_call.c(4)[int]
+add, arg 2 used inconsistently         msg_005_define.c(2)[double]  ::  msg_005_call.c(4)[int]
+add, arg 1 declared inconsistently (double != int)     msg_005_define.c(2) :: msg_005_call.c(2)
+add, arg 2 declared inconsistently (double != int)     msg_005_define.c(2) :: msg_005_call.c(2)
diff -r 3d15f2c0c3e8 -r 782cb11ba63f tests/usr.bin/xlint/lint2/msg_005.ln
--- a/tests/usr.bin/xlint/lint2/msg_005.ln      Sat Aug 07 18:40:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint2/msg_005.ln      Sat Aug 07 19:07:03 2021 +0000
@@ -1,6 +1,17 @@
-# $NetBSD: msg_005.ln,v 1.1 2021/08/05 22:36:08 rillig Exp $
+# $NetBSD: msg_005.ln,v 1.2 2021/08/07 19:07:03 rillig Exp $
 #
 # Test data for message 5 of lint2:
 #      %s value declared inconsistently (%s != %s)     %s  ::  %s
-#
-# TODO: add actual test data
+
+# msg_005_define.c:2: double add(double a, double b) { return a + b; }
+0smsg_005_define.c
+Smsg_005_define.c
+2d0.2dr3addF2DDD
+
+# msg_005_call.c:2: int add(int, int);
+# msg_005_call.c:4: int main(void) { return add(2, 3); }
+0smsg_005_call.c
+Smsg_005_call.c
+2d0.2e3addF2III
+4c0.4p1p2u3addf2III
+4d0.4dr4mainF0I
diff -r 3d15f2c0c3e8 -r 782cb11ba63f tests/usr.bin/xlint/lint2/msg_006.exp
--- a/tests/usr.bin/xlint/lint2/msg_006.exp     Sat Aug 07 18:40:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint2/msg_006.exp     Sat Aug 07 19:07:03 2021 +0000
@@ -0,0 +1,6 @@
+add value used inconsistently          msg_006_define.c(2)  ::  msg_006_call.c(4)
+add value declared inconsistently (double != int)      msg_006_define.c(2)  ::  msg_006_call.c(2)
+add, arg 1 used inconsistently         msg_006_define.c(2)[double]  ::  msg_006_call.c(4)[int]
+add, arg 2 used inconsistently         msg_006_define.c(2)[double]  ::  msg_006_call.c(4)[int]
+add, arg 1 declared inconsistently (double != int)     msg_006_define.c(2) :: msg_006_call.c(2)
+add, arg 2 declared inconsistently (double != int)     msg_006_define.c(2) :: msg_006_call.c(2)
diff -r 3d15f2c0c3e8 -r 782cb11ba63f tests/usr.bin/xlint/lint2/msg_006.ln
--- a/tests/usr.bin/xlint/lint2/msg_006.ln      Sat Aug 07 18:40:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint2/msg_006.ln      Sat Aug 07 19:07:03 2021 +0000
@@ -1,6 +1,17 @@
-# $NetBSD: msg_006.ln,v 1.1 2021/08/05 22:36:08 rillig Exp $
+# $NetBSD: msg_006.ln,v 1.2 2021/08/07 19:07:03 rillig Exp $
 #
 # Test data for message 6 of lint2:
 #      %s, arg %d used inconsistently          %s[%s]  ::  %s[%s]
-#
-# TODO: add actual test data
+
+# msg_006_define.c:2: double add(double a, double b) { return a + b; }
+0smsg_006_define.c
+Smsg_006_define.c
+2d0.2dr3addF2DDD
+
+# msg_006_call.c:2: int add(int, int);
+# msg_006_call.c:4: int main(void) { return add(2, 3); }
+0smsg_006_call.c
+Smsg_006_call.c
+2d0.2e3addF2III
+4c0.4p1p2u3addf2III
+4d0.4dr4mainF0I
diff -r 3d15f2c0c3e8 -r 782cb11ba63f tests/usr.bin/xlint/lint2/msg_011.exp
--- a/tests/usr.bin/xlint/lint2/msg_011.exp     Sat Aug 07 18:40:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint2/msg_011.exp     Sat Aug 07 19:07:03 2021 +0000
@@ -0,0 +1,6 @@
+add value used inconsistently          msg_011_define.c(2)  ::  msg_011_call.c(4)
+add value declared inconsistently (double != int)      msg_011_define.c(2)  ::  msg_011_call.c(2)
+add, arg 1 used inconsistently         msg_011_define.c(2)[double]  ::  msg_011_call.c(4)[int]
+add, arg 2 used inconsistently         msg_011_define.c(2)[double]  ::  msg_011_call.c(4)[int]
+add, arg 1 declared inconsistently (double != int)     msg_011_define.c(2) :: msg_011_call.c(2)
+add, arg 2 declared inconsistently (double != int)     msg_011_define.c(2) :: msg_011_call.c(2)
diff -r 3d15f2c0c3e8 -r 782cb11ba63f tests/usr.bin/xlint/lint2/msg_011.ln
--- a/tests/usr.bin/xlint/lint2/msg_011.ln      Sat Aug 07 18:40:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint2/msg_011.ln      Sat Aug 07 19:07:03 2021 +0000
@@ -1,6 +1,17 @@
-# $NetBSD: msg_011.ln,v 1.1 2021/08/05 22:36:08 rillig Exp $
+# $NetBSD: msg_011.ln,v 1.2 2021/08/07 19:07:03 rillig Exp $
 #
 # Test data for message 11 of lint2:
 #      %s, arg %d declared inconsistently (%s != %s)   %s :: %s
-#
-# TODO: add actual test data
+
+# msg_011_define.c:2: double add(double a, double b) { return a + b; }
+0smsg_011_define.c
+Smsg_011_define.c
+2d0.2dr3addF2DDD
+
+# msg_011_call.c:2: int add(int, int);
+# msg_011_call.c:4: int main(void) { return add(2, 3); }
+0smsg_011_call.c
+Smsg_011_call.c
+2d0.2e3addF2III
+4c0.4p1p2u3addf2III
+4d0.4dr4mainF0I
diff -r 3d15f2c0c3e8 -r 782cb11ba63f tests/usr.bin/xlint/lint2/msg_012.exp
--- a/tests/usr.bin/xlint/lint2/msg_012.exp     Sat Aug 07 18:40:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint2/msg_012.exp     Sat Aug 07 19:07:03 2021 +0000
@@ -0,0 +1,1 @@
+add: variable # of args declared       msg_012_a.c(2)  ::  msg_012_b.c(2)
diff -r 3d15f2c0c3e8 -r 782cb11ba63f tests/usr.bin/xlint/lint2/msg_012.ln
--- a/tests/usr.bin/xlint/lint2/msg_012.ln      Sat Aug 07 18:40:45 2021 +0000
+++ b/tests/usr.bin/xlint/lint2/msg_012.ln      Sat Aug 07 19:07:03 2021 +0000
@@ -1,6 +1,14 @@
-# $NetBSD: msg_012.ln,v 1.1 2021/08/05 22:36:08 rillig Exp $
+# $NetBSD: msg_012.ln,v 1.2 2021/08/07 19:07:03 rillig Exp $
 #
 # Test data for message 12 of lint2:
 #      %s: variable # of args declared         %s  ::  %s
-#
-# TODO: add actual test data
+
+# msg_012_a.c:2: int add(int, int);
+0smsg_012_a.c
+Smsg_012_a.c
+2d0.2e3addF2III
+
+# msg_012_b.c:2: int add(int, int, int);
+0smsg_012_b.c
+Smsg_012_b.c
+2d0.2e3addF3IIII



Home | Main Index | Thread Index | Old Index