Module Name:    src
Committed By:   rillig
Date:           Fri Oct 29 16:49:46 UTC 2021

Modified Files:
        src/tests/usr.bin/indent: t_errors.sh

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


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/indent/t_errors.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/indent/t_errors.sh
diff -u src/tests/usr.bin/indent/t_errors.sh:1.9 src/tests/usr.bin/indent/t_errors.sh:1.10
--- src/tests/usr.bin/indent/t_errors.sh:1.9	Fri Oct 29 16:43:05 2021
+++ src/tests/usr.bin/indent/t_errors.sh	Fri Oct 29 16:49:46 2021
@@ -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 @@ unbalanced_parentheses_2_body()
 	    "$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_init_test_cases()
 	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'
 }

Reply via email to