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: condense test for indenta...
details: https://anonhg.NetBSD.org/src/rev/2cace02de42b
branches: trunk
changeset: 989888:2cace02de42b
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Oct 18 22:46:33 2021 +0000
description:
tests/indent: condense test for indentation level, add missing files
diffstat:
distrib/sets/lists/tests/mi | 45 ++++++++++++++++++++-
tests/usr.bin/indent/Makefile | 6 +-
tests/usr.bin/indent/ps_ind_level.0 | 17 --------
tests/usr.bin/indent/ps_ind_level.0.pro | 5 --
tests/usr.bin/indent/ps_ind_level.0.stdout | 12 -----
tests/usr.bin/indent/ps_ind_level.c | 61 ++++++++++++++++++++++++++++++
6 files changed, 104 insertions(+), 42 deletions(-)
diffs (199 lines):
diff -r 12e678cc08ba -r 2cace02de42b distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Mon Oct 18 22:30:34 2021 +0000
+++ b/distrib/sets/lists/tests/mi Mon Oct 18 22:46:33 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1145 2021/10/18 22:30:34 rillig Exp $
+# $NetBSD: mi,v 1.1146 2021/10/18 22:46:33 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -5023,9 +5023,10 @@
./usr/tests/usr.bin/indent/pcs.0 tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/pcs.0.pro tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/pcs.0.stdout tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/indent/ps_ind_level.0 tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/indent/ps_ind_level.0.pro tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/indent/ps_ind_level.0.stdout tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/ps_ind_level.0 tests-obsolete obsolete,atf
+./usr/tests/usr.bin/indent/ps_ind_level.0.pro tests-obsolete obsolete,atf
+./usr/tests/usr.bin/indent/ps_ind_level.0.stdout tests-obsolete obsolete,atf
+./usr/tests/usr.bin/indent/ps_ind_level.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/struct.0 tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/struct.0.stdout tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/surplusbad.0 tests-usr.bin-tests compattestfile,atf
@@ -5150,8 +5151,44 @@
./usr/tests/usr.bin/indent/token-while_expr.0 tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/token-while_expr.0.pro tests-obsolete obsolete,atf
./usr/tests/usr.bin/indent/token-while_expr.0.stdout tests-obsolete obsolete,atf
+./usr/tests/usr.bin/indent/token_binary_op.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_case_label.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_colon.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_comma.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/token_comment.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_decl.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_do_stmt.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_end_of_file.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_for_exprs.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_form_feed.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_funcname.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/token_ident.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_if_expr.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_if_expr_stmt.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_if_expr_stmt_else.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_keyword_do.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_keyword_do_else.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_keyword_else.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_keyword_for_if_while.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_keyword_struct_union_enum.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_lbrace.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_lparen.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_newline.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_period.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_postfix_op.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_preprocessing.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_question.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_rbrace.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_rparen.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_semicolon.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_stmt.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_stmt_list.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_storage_class.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_string_prefix.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_switch_expr.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_type_def.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_unary_op.c tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/indent/token_while_expr.c tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/types_from_file.0 tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/types_from_file.0.list tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/indent/types_from_file.0.pro tests-usr.bin-tests compattestfile,atf
diff -r 12e678cc08ba -r 2cace02de42b tests/usr.bin/indent/Makefile
--- a/tests/usr.bin/indent/Makefile Mon Oct 18 22:30:34 2021 +0000
+++ b/tests/usr.bin/indent/Makefile Mon Oct 18 22:46:33 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.20 2021/10/18 22:30:34 rillig Exp $
+# $NetBSD: Makefile,v 1.21 2021/10/18 22:46:33 rillig Exp $
.include <bsd.own.mk>
@@ -137,9 +137,7 @@
FILES+= pcs.0
FILES+= pcs.0.stdout
FILES+= pcs.0.pro
-FILES+= ps_ind_level.0
-FILES+= ps_ind_level.0.pro
-FILES+= ps_ind_level.0.stdout
+FILES+= ps_ind_level.c
FILES+= struct.0
FILES+= struct.0.stdout
FILES+= surplusbad.0
diff -r 12e678cc08ba -r 2cace02de42b tests/usr.bin/indent/ps_ind_level.0
--- a/tests/usr.bin/indent/ps_ind_level.0 Mon Oct 18 22:30:34 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-/* $NetBSD: ps_ind_level.0,v 1.2 2021/10/05 17:12:20 rillig Exp $ */
-/* $FreeBSD$ */
-/* $ */
-/* $ The leading indentation in the first line determines the indentation */
-/* $ of the remaining code. In this particular test, the indentation is set */
-/* $ to 5 and the tabulator is set to 8, to demonstrate an off-by-one error */
-/* $ in main_prepare_parsing that has been fixed in indent.c 1.107 from */
-/* $ 2021-10-05. */
-/* $ */
-/* $ The declaration in the below line is indented by 3 tabs, amounting to */
-/* $ 24 spaces. The initial indentation of the code is intended to be */
-/* $ rounded down, to 4 levels of indentation, amounting to 20 spaces. */
- int declaration_in_column_25;
-
-/* $ Even if later code has a smaller indentation, it is nevertheless */
-/* $ indented to the level given by the first line of code. */
-void function_in_column_1(void){}
diff -r 12e678cc08ba -r 2cace02de42b tests/usr.bin/indent/ps_ind_level.0.pro
--- a/tests/usr.bin/indent/ps_ind_level.0.pro Mon Oct 18 22:30:34 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-/* $NetBSD: ps_ind_level.0.pro,v 1.1 2021/10/05 17:09:45 rillig Exp $ */
-/* $FreeBSD$ */
-
--i5 /* 5 spaces indentation */
--ts8 /* 8 spaces per tabulator */
diff -r 12e678cc08ba -r 2cace02de42b tests/usr.bin/indent/ps_ind_level.0.stdout
--- a/tests/usr.bin/indent/ps_ind_level.0.stdout Mon Oct 18 22:30:34 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-/* $NetBSD: ps_ind_level.0.stdout,v 1.3 2021/10/05 17:27:11 rillig Exp $ */
-/* $FreeBSD$ */
-/* $ */
- int declaration_in_column_25;
-
-/* $ The space between '){' is missing. This is because the tokenizer only */
-/* $ recognizes function definitions if they start at indentation level 0, */
-/* $ but this declaration starts at indentation level 4, due to the */
-/* $ declaration above. It's an edge case and probably not worth fixing. */
-/* $ See 'in_parameter_declaration = true'. */
- void function_in_column_1(void){
- }
diff -r 12e678cc08ba -r 2cace02de42b tests/usr.bin/indent/ps_ind_level.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/indent/ps_ind_level.c Mon Oct 18 22:46:33 2021 +0000
@@ -0,0 +1,61 @@
+/* $NetBSD: ps_ind_level.c,v 1.1 2021/10/18 22:46:33 rillig Exp $ */
+/* $FreeBSD$ */
+
+/*
+ * The indentation of the very first line of a file determines the
+ * indentation of the remaining code. Even if later code has a smaller
+ * indentation, it is nevertheless indented to the level given by the first
+ * line of code.
+ *
+ * In this particular test, the indentation is set to 5 and the tabulator
+ * width is set to 8, to demonstrate an off-by-one error in
+ * main_prepare_parsing that has been fixed in indent.c 1.107 from 2021-10-05.
+ *
+ * The declaration in the first line is indented by 3 tabs, amounting to 24
+ * spaces. The initial indentation of the code is intended to be rounded down,
+ * to 4 levels of indentation, amounting to 20 spaces.
+ */
+#indent input
+ int declaration_in_column_25;
+
+void function_in_column_1(void){}
+#indent end
+
+/* 5 spaces indentation, 8 spaces per tabulator */
+#indent run -i5 -ts8
+ int declaration_in_column_25;
+
+ void function_in_column_1(void){
+ }
+#indent end
+/*
+ * In the above function declaration, the space between '){' is missing. This
+ * is because the tokenizer only recognizes function definitions if they start
+ * at indentation level 0, but this declaration starts at indentation level 4,
+ * due to the indentation in line 1. It's an edge case and probably not worth
+ * fixing.
+ *
+ * See 'in_parameter_declaration = true'.
+ */
+
+
+/*
+ * Labels are always indented 2 levels left of the code. The first line starts
+ * at indentation level 3, the code in the function is therefore at level 4,
+ * and the label is at level 2, sticking out of the code.
+ */
+#indent input
+ int indent_by_24;
+
+void function(void) {
+label:;
+}
+#indent end
+
+#indent run -i8 -ts8 -di0
+ int indent_by_24;
+
+ void function(void){
+ label: ;
+ }
+#indent end
Home |
Main Index |
Thread Index |
Old Index