Source-Changes-HG archive

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

[src/trunk]: src/tests/usr.bin/indent indent/tests: demonstrate wrong line nu...



details:   https://anonhg.NetBSD.org/src/rev/6748b8828c57
branches:  trunk
changeset: 990035:6748b8828c57
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 24 16:46:12 2021 +0000

description:
indent/tests: demonstrate wrong line number counting

diffstat:

 tests/usr.bin/indent/t_misc.sh |  22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diffs (42 lines):

diff -r 68b5ab241650 -r 6748b8828c57 tests/usr.bin/indent/t_misc.sh
--- a/tests/usr.bin/indent/t_misc.sh    Sun Oct 24 16:38:00 2021 +0000
+++ b/tests/usr.bin/indent/t_misc.sh    Sun Oct 24 16:46:12 2021 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: t_misc.sh,v 1.5 2021/10/23 21:45:14 rillig Exp $
+# $NetBSD: t_misc.sh,v 1.6 2021/10/24 16:46:12 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -306,6 +306,25 @@
            "$indent" -Ucode.types code.c -di0 -st
 }
 
+atf_test_case 'line_no_counting'
+line_no_counting_body()
+{
+       cat <<-\EOF > code.c
+               void line_no_counting(void)
+               {
+                       ())
+               }
+       EOF
+
+       # FIXME: the wrong ')' is in line 3, not 2.
+       cat <<-\EOF > code.err
+               /**INDENT** Warning@2: Extra ) */
+       EOF
+
+       atf_check -o 'ignore' -e 'file:code.err' \
+           "$indent" code.c -st
+}
+
 atf_init_test_cases()
 {
        atf_add_test_case 'in_place'
@@ -315,4 +334,5 @@
        atf_add_test_case 'opt'
        atf_add_test_case 'opt_npro'
        atf_add_test_case 'opt_U'
+       atf_add_test_case 'line_no_counting'
 }



Home | Main Index | Thread Index | Old Index