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 tests/indent: provoke the third occurre...



details:   https://anonhg.NetBSD.org/src/rev/e0c133bec391
branches:  trunk
changeset: 990508:e0c133bec391
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 29 16:49:46 2021 +0000

description:
tests/indent: provoke the third occurrence of 'unbalanced parens'

diffstat:

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

diffs (43 lines):

diff -r 70444ab1aa64 -r e0c133bec391 tests/usr.bin/indent/t_errors.sh
--- a/tests/usr.bin/indent/t_errors.sh  Fri Oct 29 16:43:05 2021 +0000
+++ b/tests/usr.bin/indent/t_errors.sh  Fri Oct 29 16:49:46 2021 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: t_errors.sh,v 1.9 2021/10/29 16:43:05 rillig Exp $
+# $NetBSD: t_errors.sh,v 1.10 2021/10/29 16:49:46 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -388,6 +388,26 @@
            "$indent" code.c
 }
 
+atf_test_case 'unbalanced_parentheses_3'
+unbalanced_parentheses_3_body()
+{
+       # '({...})' is the GCC extension "Statement expression".
+       cat <<-\EOF > code.c
+               int var =
+               (
+               1
+               }
+               ;
+       EOF
+       cat <<-\EOF > stderr.exp
+               error: code.c:4: Unbalanced parens
+               error: code.c:4: Statement nesting error
+       EOF
+
+       atf_check -s 'exit:1' -e 'file:stderr.exp' \
+           "$indent" code.c
+}
+
 
 atf_init_test_cases()
 {
@@ -419,4 +439,5 @@
        atf_add_test_case 'preprocessing_unrecognized'
        atf_add_test_case 'unbalanced_parentheses_1'
        atf_add_test_case 'unbalanced_parentheses_2'
+       atf_add_test_case 'unbalanced_parentheses_3'
 }



Home | Main Index | Thread Index | Old Index