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 segmentation ...



details:   https://anonhg.NetBSD.org/src/rev/be5931f5c828
branches:  trunk
changeset: 990523:be5931f5c828
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 29 19:39:32 2021 +0000

description:
tests/indent: demonstrate segmentation fault in search_stmt_comment

diffstat:

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

diffs (31 lines):

diff -r fa83431d6076 -r be5931f5c828 tests/usr.bin/indent/t_errors.sh
--- a/tests/usr.bin/indent/t_errors.sh  Fri Oct 29 19:31:24 2021 +0000
+++ b/tests/usr.bin/indent/t_errors.sh  Fri Oct 29 19:39:32 2021 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: t_errors.sh,v 1.11 2021/10/29 16:54:51 rillig Exp $
+# $NetBSD: t_errors.sh,v 1.12 2021/10/29 19:39:32 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -408,6 +408,14 @@
            "$indent" code.c
 }
 
+atf_test_case 'search_stmt_comment_segv'
+search_stmt_comment_segv_body()
+{
+       printf '{if(expr\n)/*c*/;}\n' > code.c
+
+       atf_check -s 'signal' \
+           "$indent" code.c -st
+}
 
 atf_init_test_cases()
 {
@@ -440,4 +448,5 @@
        atf_add_test_case 'unbalanced_parentheses_1'
        atf_add_test_case 'unbalanced_parentheses_2'
        atf_add_test_case 'unbalanced_parentheses_3'
+       atf_add_test_case 'search_stmt_comment_segv'
 }



Home | Main Index | Thread Index | Old Index