tests/indent: add more tests, from indent's own code

This commit is contained in:
rillig 2023-06-08 20:49:04 +00:00
parent 6b78dc3375
commit cfb043929d
2 changed files with 24 additions and 2 deletions

View File

@ -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

View File

@ -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