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: demonstrate assertion fai...
details: https://anonhg.NetBSD.org/src/rev/0aa4d1abfc8d
branches: trunk
changeset: 1024661:0aa4d1abfc8d
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Oct 30 16:43:23 2021 +0000
description:
tests/indent: demonstrate assertion failure in fits_in_one_line
diffstat:
tests/usr.bin/indent/t_errors.sh | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diffs (42 lines):
diff -r 10612e502d4c -r 0aa4d1abfc8d tests/usr.bin/indent/t_errors.sh
--- a/tests/usr.bin/indent/t_errors.sh Sat Oct 30 16:18:51 2021 +0000
+++ b/tests/usr.bin/indent/t_errors.sh Sat Oct 30 16:43:23 2021 +0000
@@ -1,5 +1,5 @@
#! /bin/sh
-# $NetBSD: t_errors.sh,v 1.15 2021/10/30 15:26:58 rillig Exp $
+# $NetBSD: t_errors.sh,v 1.16 2021/10/30 16:43:23 rillig Exp $
#
# Copyright (c) 2021 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -429,6 +429,25 @@
"$indent" code.c -st
}
+atf_test_case 'search_stmt_fits_in_one_line'
+search_stmt_fits_in_one_line_body()
+{
+ # The comment is placed after 'if (0) ...', where it is processed
+ # by search_stmt_comment. That function redirects the input buffer to
+ # a temporary buffer that is not guaranteed to be terminated by '\n'.
+ cat <<EOF > code.c
+int f(void)
+{
+ if (0)
+ /* 0123456789012345678901 */;
+}
+EOF
+
+ atf_check -s 'signal' -o 'ignore' -e 'match:assert' \
+ "$indent" -l34 code.c -st
+}
+
+
atf_init_test_cases()
{
atf_add_test_case 'option_unknown'
@@ -461,4 +480,5 @@
atf_add_test_case 'unbalanced_parentheses_2'
atf_add_test_case 'unbalanced_parentheses_3'
atf_add_test_case 'search_stmt_comment_segv'
+ atf_add_test_case 'search_stmt_fits_in_one_line'
}
Home |
Main Index |
Thread Index |
Old Index