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: test options without '-' ...



details:   https://anonhg.NetBSD.org/src/rev/a4a410ee3893
branches:  trunk
changeset: 1024849:a4a410ee3893
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 07 15:01:50 2021 +0000

description:
tests/indent: test options without '-' in profile files

diffstat:

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

diffs (40 lines):

diff -r 7bfe4b54a0df -r a4a410ee3893 tests/usr.bin/indent/t_misc.sh
--- a/tests/usr.bin/indent/t_misc.sh    Sun Nov 07 14:34:30 2021 +0000
+++ b/tests/usr.bin/indent/t_misc.sh    Sun Nov 07 15:01:50 2021 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: t_misc.sh,v 1.12 2021/10/30 09:32:46 rillig Exp $
+# $NetBSD: t_misc.sh,v 1.13 2021/11/07 15:01:50 rillig Exp $
 #
 # Copyright (c) 2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -190,6 +190,21 @@
            "$indent" < code.c
 }
 
+atf_test_case 'option_without_hyphen'
+option_without_hyphen_body()
+{
+       # TODO: Options in profile files should be required to start with
+       #  '-', just like in the command line arguments.
+
+       printf ' -i3 xi5 +di0\n' > .indent.pro
+
+       printf '%s\n' 'int var[] = {' '1,' '}' > code.c
+       printf '%s\n' 'int var[] = {' '     1,' '}' > code.exp
+
+       atf_check -o 'file:code.exp' \
+           "$indent" < code.c
+}
+
 atf_test_case 'opt'
 opt_body()
 {
@@ -355,6 +370,7 @@
        atf_add_test_case 'verbose_profile'
        atf_add_test_case 'nested_struct_declarations'
        atf_add_test_case 'option_P_in_profile_file'
+       atf_add_test_case 'option_without_hyphen'
        atf_add_test_case 'opt'
        atf_add_test_case 'opt_npro'
        atf_add_test_case 'opt_U'



Home | Main Index | Thread Index | Old Index