frawor / test / gentests-mappings.pl

#!/usr/bin/perl
use strict;
use warnings;
use integer;
use utf8;
use open qw(:utf8);
my @testmaps=qw(
     "aph
     "apj
     "apl
     k
     a
    oa
     Pa
    oPa
     P
     Pe
     Pd
     d
    of!
    og!
);
my $teststr="";
while(my ($i, $s)=each(@testmaps)) {
    $teststr.="$s\c\\cn:WW\n";
}
$_=<<"EOF";
:let &rtp.=",".escape(\$TESTDIR, ',\\').'/rtp'
:source mappings.vim
:let \@"='paste'
:let \@a='apaste'
:command WW if !empty(getline('.')) | call WriteFile("=".getline('.')) | endif | %d_
:W> 2
@@@
:W> 1
:wincmd w
@@@
:W> 2
:wincmd w
:W+ twoload
:runtime! plugin/mappings-twoload.vim
@@@
:W> 1
:wincmd w
@@@
:W> 2
:wincmd w
:W* unload
:let tosource=FraworUnload(g:testfile[:-5])+FraworUnload('plugin/mappings-twoload')
@@@
:W> 1
:wincmd w
@@@
:W> 2
:wincmd w
:W* source
:for src in tosource | execute "source" fnameescape(src) | endfor
@@@
:W> 1
:wincmd w
@@@
:W> 2
:wincmd w
EOF
s/@@@/$teststr/g;
my $F;
open $F, ">", "mappings.in";
print $F $_;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.