diff options
author | David Bürgin <676c7473@gmail.com> | 2015-04-07 16:48:21 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-04-09 11:40:09 -0400 |
commit | cb7bb70c4902a38165e3d1cb3158704dbac228c4 (patch) | |
tree | 8a597189fd26db974d95b798d11bd4d3ecf452a6 /scripts/legacy2luatest.pl | |
parent | 42af7daa25acff253b663db9da5859f6c7aaaa56 (diff) | |
download | rneovim-cb7bb70c4902a38165e3d1cb3158704dbac228c4.tar.gz rneovim-cb7bb70c4902a38165e3d1cb3158704dbac228c4.tar.bz2 rneovim-cb7bb70c4902a38165e3d1cb3158704dbac228c4.zip |
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>
Diffstat (limited to 'scripts/legacy2luatest.pl')
-rwxr-xr-x | scripts/legacy2luatest.pl | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/scripts/legacy2luatest.pl b/scripts/legacy2luatest.pl index 51997c037b..1a3f54146e 100755 --- a/scripts/legacy2luatest.pl +++ b/scripts/legacy2luatest.pl @@ -42,15 +42,8 @@ sub read_in_file { my $command_lines = $_[1]; my $test_body_lines = $_[2]; - # Only keep first input line if it is not empty. - my $first_input_line = shift @{$input_lines}; - 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 there are input lines, wrap with an `insert` + # command and add before the previous command block. if (@{$input_lines}) { my $last_input_line = pop @{$input_lines}; unshift @{$command_lines}, ''; @@ -168,7 +161,10 @@ sub read_in_file { return EMIT_COMMAND; } - push @input_lines, ' ' . $_; + # Skip initial lines if they are empty. + if (@input_lines or !/^$/) { + push @input_lines, ' ' . $_; + } return EMIT_INPUT; }, ); |