From cfb043929d697f93faef29cc8a30dffc3f17dd56 Mon Sep 17 00:00:00 2001 From: rillig Date: Thu, 8 Jun 2023 20:49:04 +0000 Subject: [PATCH] tests/indent: add more tests, from indent's own code --- tests/usr.bin/indent/lsym_lparen_or_lbracket.c | 18 +++++++++++++++++- tests/usr.bin/indent/lsym_unary_op.c | 8 +++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/usr.bin/indent/lsym_lparen_or_lbracket.c b/tests/usr.bin/indent/lsym_lparen_or_lbracket.c index 9f3b6bef6037..7b516cdf05b7 100644 --- a/tests/usr.bin/indent/lsym_lparen_or_lbracket.c +++ b/tests/usr.bin/indent/lsym_lparen_or_lbracket.c @@ -1,4 +1,4 @@ -/* $NetBSD: lsym_lparen_or_lbracket.c,v 1.13 2023/06/04 18:58:30 rillig Exp $ */ +/* $NetBSD: lsym_lparen_or_lbracket.c,v 1.14 2023/06/08 20:49:04 rillig Exp $ */ /* * Tests for the token lsym_lparen_or_lbracket, which represents a '(' or '[' @@ -336,3 +336,19 @@ cover_want_blank_before_lparen(void) //indent end /* See t_errors.sh, test case 'compound_literal'. */ + + +//indent input +int arr[] = { +['0'] = 1, +['1'] = 2, +}; +//indent end + +//indent run -di0 +int arr[] = { + ['0'] = 1, +// $ FIXME: 1 space extra indentation. + ['1'] = 2, +}; +//indent end diff --git a/tests/usr.bin/indent/lsym_unary_op.c b/tests/usr.bin/indent/lsym_unary_op.c index b6ed75f6b75b..97656c3ceb02 100644 --- a/tests/usr.bin/indent/lsym_unary_op.c +++ b/tests/usr.bin/indent/lsym_unary_op.c @@ -1,4 +1,4 @@ -/* $NetBSD: lsym_unary_op.c,v 1.8 2023/06/02 14:21:55 rillig Exp $ */ +/* $NetBSD: lsym_unary_op.c,v 1.9 2023/06/08 20:49:04 rillig Exp $ */ /* * Tests for the token lsym_unary_op, which represents a unary operator. @@ -82,6 +82,8 @@ unary_operators(void) //indent input { sbuf_t *sb = *(sbuf_t **)sp; +return (int)(a * (float)b); +a = (2 * b == c); } //indent end @@ -89,5 +91,9 @@ sbuf_t *sb = *(sbuf_t **)sp; { // $ FIXME: Wrong spacing after the cast. sbuf_t *sb = *(sbuf_t **) sp; +// $ FIXME: Wrong spacing after the '*'. + return (int)(a *(float)b); +// $ FIXME: Wrong spacing after the '*'. + a = (2 *b == c); } //indent end