tests/indent: separate stdout from stderr

Due to buffering, there was no guarantee that the output would be
exactly in the same order as written in the tests.
This commit is contained in:
rillig 2023-06-14 17:07:32 +00:00
parent d0e2347d25
commit ca9074275c
4 changed files with 15 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fmt_expr.c,v 1.7 2023/06/10 08:17:04 rillig Exp $ */
/* $NetBSD: fmt_expr.c,v 1.8 2023/06/14 17:07:32 rillig Exp $ */
/*
* Tests for all kinds of expressions that are not directly related to unary
@ -44,8 +44,6 @@
//indent end
//indent run -di0
error: Standard Input:7: Unbalanced parentheses
warning: Standard Input:9: Extra ')'
{
int var = ({1});
int var = ({
@ -57,4 +55,6 @@ warning: Standard Input:9: Extra ')'
});
}
exit 1
error: Standard Input:7: Unbalanced parentheses
warning: Standard Input:9: Extra ')'
//indent end

View File

@ -1,4 +1,4 @@
/* $NetBSD: lsym_preprocessing.c,v 1.12 2023/06/14 10:29:52 rillig Exp $ */
/* $NetBSD: lsym_preprocessing.c,v 1.13 2023/06/14 17:07:32 rillig Exp $ */
/*
* Tests for the token lsym_preprocessing, which represents a '#' that starts
@ -294,10 +294,6 @@ int before;
//indent end
//indent run
error: Standard Input:1: Unmatched #else
error: Standard Input:2: Unmatched #elif
error: Standard Input:3: Unmatched #elifdef
error: Standard Input:4: Unmatched #endif
#else
#elif 0
#elifdef var
@ -306,4 +302,8 @@ error: Standard Input:4: Unmatched #endif
#unknown
# 3 "file.c"
exit 1
error: Standard Input:1: Unmatched #else
error: Standard Input:2: Unmatched #elif
error: Standard Input:3: Unmatched #elifdef
error: Standard Input:4: Unmatched #endif
//indent end

View File

@ -1,4 +1,4 @@
/* $NetBSD: psym_else.c,v 1.5 2023/06/10 17:35:41 rillig Exp $ */
/* $NetBSD: psym_else.c,v 1.6 2023/06/14 17:07:32 rillig Exp $ */
/*
* Tests for the parser symbol psym_else, which represents the keyword 'else'
@ -80,9 +80,9 @@ function(void)
//indent end
//indent run
error: Standard Input:2: Unmatched 'else'
{
else
}
exit 1
error: Standard Input:2: Unmatched 'else'
//indent end

View File

@ -1,4 +1,4 @@
-- $NetBSD: t_options.lua,v 1.4 2023/05/22 06:35:56 rillig Exp $
-- $NetBSD: t_options.lua,v 1.5 2023/06/14 17:07:32 rillig Exp $
--
-- Copyright (c) 2023 The NetBSD Foundation, Inc.
-- All rights reserved.
@ -126,7 +126,7 @@ end
local function run_indent(inp, args)
local indent = os.getenv("INDENT") or "indent"
local cmd = indent .. " " .. args .. " 2>&1"
local cmd = indent .. " " .. args .. " 2>t_options.err"
local indent_in = assert(io.popen(cmd, "w"))
indent_in:write(inp)
@ -134,6 +134,9 @@ local function run_indent(inp, args)
if not ok then
print(kind .. " " .. info)
end
for line in io.lines("t_options.err") do
print(line)
end
end
local function handle_empty_section(line)