mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
scripts: Fix "test input line" logic in legacy2luatest.pl #2369
Fixes the handling of the initial input lines of a test script by simply skipping all initial empty lines. Helped-by: Florian Walch <florian@fwalch.com> Suggested-by: Florian Walch <florian@fwalch.com>
This commit is contained in:
parent
42af7daa25
commit
cb7bb70c49
@ -42,15 +42,8 @@ sub read_in_file {
|
|||||||
my $command_lines = $_[1];
|
my $command_lines = $_[1];
|
||||||
my $test_body_lines = $_[2];
|
my $test_body_lines = $_[2];
|
||||||
|
|
||||||
# Only keep first input line if it is not empty.
|
# If there are input lines, wrap with an `insert`
|
||||||
my $first_input_line = shift @{$input_lines};
|
# command and add before the previous command block.
|
||||||
if ($first_input_line =~ /^$/) {
|
|
||||||
unshift @{$input_lines}, $first_input_line;
|
|
||||||
}
|
|
||||||
|
|
||||||
# If there are input lines left, wrap them with
|
|
||||||
# `insert` command and add before the previous command
|
|
||||||
# block.
|
|
||||||
if (@{$input_lines}) {
|
if (@{$input_lines}) {
|
||||||
my $last_input_line = pop @{$input_lines};
|
my $last_input_line = pop @{$input_lines};
|
||||||
unshift @{$command_lines}, '';
|
unshift @{$command_lines}, '';
|
||||||
@ -168,7 +161,10 @@ sub read_in_file {
|
|||||||
return EMIT_COMMAND;
|
return EMIT_COMMAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
push @input_lines, ' ' . $_;
|
# Skip initial lines if they are empty.
|
||||||
|
if (@input_lines or !/^$/) {
|
||||||
|
push @input_lines, ' ' . $_;
|
||||||
|
}
|
||||||
return EMIT_INPUT;
|
return EMIT_INPUT;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user