Commits

ZyX_I  committed ee26ee7

Changed mappings test

  • Participants
  • Parent commits 19fe5d6

Comments (0)

Files changed (7)

File test/augroup.ok

 2: /home/zyx/a.a/.settings/home/.vim/dev/repository/tmp/test/ghi
 non-empty: /home/zyx/a.a/.settings/home/.vim/dev/repository/tmp/test/ghi
 >>> messages
-"abc" [Новый файл]
-"def" [Новый файл]
-"ghi" [Новый файл]
-"jkl" [Новый файл]
+"abc" [New File]
+"def" [New File]
+"ghi" [New File]
+"jkl" [New File]
 <<< messages
 ===
 testenter: 
 2: /home/zyx/a.a/.settings/home/.vim/dev/repository/tmp/test/ghi
 non-empty: /home/zyx/a.a/.settings/home/.vim/dev/repository/tmp/test/ghi
 >>> messages
-"abc" [Новый файл]
-"def" [Новый файл]
-"ghi" [Новый файл]
-"jkl" [Новый файл]
+"abc" [New File]
+"def" [New File]
+"ghi" [New File]
+"jkl" [New File]
 <<< messages

File test/gentests-mappings.pl

 use utf8;
 use open qw(:utf8);
 my @testmaps=qw(
-     ;h
-     ;j
-     ;l
+     "aph
+     "apj
+     "apl
      k
      a
     oa
-     \a
-    o\a
-     \
-     \e
-     \d
+     Pa
+    oPa
+     P
+     Pe
+     Pd
      d
     of!
     og!
 );
-my @suf=("", chr 0x0301, chr 0x0302, chr 0x0303, chr 0x0306, chr 0x0315,
-             chr 0x0316, chr 0x031A, chr 0x0329, chr 0x0332, chr 0x0333,
-             chr 0x0336, chr 0x033F, chr 0x0344);
 my $teststr="";
 while(my ($i, $s)=each(@testmaps)) {
-    $teststr.='o@@@'.$suf[$i]."\e$s\c\\cn";
+    $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
-:call WriteFile('>>> buf1 <<<', '')
-:w! buf1.txt
-:execute "w! ++ff=unix >> ".fnameescape(g:outfile)
-:wincmd w
-:call WriteFile('>>> buf2 <<<', '')
-:w! buf2.txt
-:execute "w! ++ff=unix >> ".fnameescape(g:outfile)
 EOF
-my $j=0;
-sub nextstr() {
-    local $_=$teststr;
-    my $s=$j/2;
-    s/@@@/$s/g;
-    $j++;
-    $_;
-}
-s/@@@/nextstr()/ge;
+s/@@@/$teststr/g;
 my $F;
 open $F, ">", "mappings.in";
 print $F $_;

File test/gwine/mappings.ok

->>> buf1 <<<
-
-args: (';', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])0
-0�args: ()�
-0�args: ()�
-0̆β
-0̕
-0̖β
-0̚
-\α
-0̩
-0̲
-0̃
-0̳
-0̶
-0̿
-ζ!
-0̈́
-η!
-args: (';', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])1
-1�args: ()�
-1�args: ()�
-1�argsλ: ('k')�
-1̆β
-1̕
-1̖β
-1̚
-\α
-1̩
-1̲
-1̳
-1̶
-1̿
-ζ!
-1̈́
-η!
-2
-2́
-2̂
-2̆
-2̕
-a
-2̖
-2̚
-\a
-2̩
-2̲
-2̃
-2̳
-2̶
-2̿
-f!
-2̈́
-g!
-args: (';', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])3
-3�args: ()�
-3�args: ()�
-3�argsλ: ('k')�
-3̆β
-3̕
-3̖β
-3̚
-\α
-3̩
-3̲
-3̳
-3̶
-3̿
-ζ!
-3̈́
-η!
-
->>> buf2 <<<
-
-args: (';', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])0
-0�args: ()�
-0�args: ()�
-0̆β
-0̕
-0̖β
-0̚
-\α
-0̩
-0̲
-0̃
-0̳
-0̶
-0̿
-ζ!
-0̈́
-g!
-args: (';', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])1
-1�args: ()�
-1�args: ()�
-1�argsλ: ('k')�
-1̆β
-1̕
-1̖β
-1̚
-\α
-1̩
-1̲
-1̳
-1̶
-1̿
-ζ!
-1̈́
-g!
-2
-2́
-2̂
-2̆
-2̕
-a
-2̖
-2̚
-\a
-2̩
-2̲
-2̃
-2̳
-2̶
-2̿
-f!
-2̈́
-g!
-args: (';h', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])3
-3́γ
-3̂γ
-3�argsλ: ('k')�
-3̆β
-3̕
-3̖β
-3̚
-\α
-3̩
-3̲
-3̳
-3̶
-3̿
-ζ!
-3̈́
-g!

File test/mappings.ok

->>> buf1 <<<
-
-args: (';', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])0
-args: ()0́
-args: ()0̂
-0̆
-0̕
+> 2
+args: ('"ap', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])
+h
+args: ()
+args: ()
+k
 α
-0̖β
-0̚
-\α
-0̩
-0̲
-0̃
-0̳
-0̶
-0̿
-ζ!
-0̈́
-η!
-args: (';', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])1
-args: ()1́
-args: ()1̂
-argsλ: ('k')1̃
-1̆β
-1̕
 α
-1̖β
-1̚
-\α
-1̩
-1̲
-1̳
-1̶
-1̿
-ζ!
-1̈́
-η!
-2
-2́
-2̂
-2̆
-2̕
-a
-2̖
-2̚
-\a
-2̩
-2̲
-2̃
-2̳
-2̶
-2̿
-f!
-2̈́
-g!
-args: (';', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])3
-args: ()3́
-args: ()3̂
-argsλ: ('k')3̃
-3̆β
-3̕
+=P
+e
+d
+=zeta!
+=eta!
+> 1
+args: ('"ap', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])
+h
+args: ()
+args: ()
+k
 α
-3̖β
-3̚
-\α
-3̩
-3̲
-3̳
-3̶
-3̿
-ζ!
-3̈́
-η!
-
->>> buf2 <<<
-
-0
-args: ()0́
-0̂
-0̆β
-0̕
 α
-0̖β
-0̚
-\α
-0̩
-0̲
-0̃
-0̳
-0̶
-0̿
-ζ!
-0̈́
-g!
-args: (';', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])1
-args: ()1́
-args: ()1̂
-argsλ: ('k')1̃
-1̆
-1̕
+=P
+e
+d
+=zeta!
+=g!
+> 2
++ twoload
+args: ('"ap', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])
+h
+args: ()
+args: ()
+lambda: ('k')
 α
-1̖β
-1̚
-\α
-1̩
-1̲
-1̳
-1̶
-1̿
-ζ!
-1̈́
-g!
-2
-2́
-2̂
-2̆
-2̕
-a
-2̖
-2̚
-\a
-2̩
-2̲
-2̃
-2̳
-2̶
-2̿
-f!
-2̈́
-g!
-args: (';h', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])3
-3́
-3̂γ
-argsλ: ('k')3̃
-3̆β
-3̕
 α
-3̖β
-3̚
-\α
-3̩
-3̲
-3̳
-3̶
-3̿
-ζ!
-3̈́
-g!
+=P
+e
+d
+=zeta!
+=eta!
+> 1
+args: ('"ap', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])
+h
+args: ()
+args: ()
+lambda: ('k')
+=P
+e
+d
+=zeta!
+=g!
+> 2
+* unload
+h
+=apaste
+j
+=apaste
+l
+=apaste
+=a
+=paste
+=Pa
+=paste
+e
+=paste
+d
+=paste
+d
+=f!
+=g!
+> 1
+h
+=apaste
+j
+=apaste
+l
+=apaste
+=a
+=paste
+=Pa
+=paste
+e
+=paste
+d
+=paste
+d
+=f!
+=g!
+> 2
+* source
+args: ('"ap', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])
+h
+args: ()
+args: ()
+lambda: ('k')
+=P
+e
+d
+=zeta!
+=eta!
+> 1
+args: ('"aph', 'n', ['def'], 'Mgroup3', 'iota', ['abc'])
+lambda: ('k')
+=P
+d
+=zeta!
+=g!
+> 2

File test/mappings.vim

+nnoremap h :call WriteFile("h")<CR>
+nnoremap j :call WriteFile("j")<CR>
+nnoremap l :call WriteFile("l")<CR>
+nnoremap k :call WriteFile("k")<CR>
+nnoremap a :call WriteFile("a")<CR>
+nnoremap e :call WriteFile("e")<CR>
+nnoremap d :call WriteFile("d")<CR>
 let g:testfile="plugin/".g:curtest.".vim"
 let g:maxcount=3
-let g:frawormap_Mgroup2='\'
-let g:frawormap_Mgroup3=';'
+let g:frawormap_Mgroup2='P'
+let g:frawormap_Mgroup3='"ap'
 let g:frawormap_Mgroup3_kappa=['j', 'l']
 let b:frawormap_Agroup_eta='g'
 source test.vim
-new +let\ b:frawormap_Mgroup2_epsilon='e'\|let\ b:frawormap_Mgroup3_iota='h'\|let\ b:frawormapOptions={'Mgroup_gamma':[';j',';l']}
+new +let\ b:frawormap_Mgroup2_epsilon='e'\|let\ b:frawormap_Mgroup3_iota='h'\|let\ b:frawormapOptions={'Mgroup_gamma':['"apj','"apl']}
 wincmd w

File test/rtp/plugin/mappings-twoload.vim

     finish
 endif
 function s:mappings.lambda.rhs.function(...)
-    return 'iargsλ: ('.string(a:000)[1:-2].")\e"
+    call WriteFile('lambda: ('.string(a:000)[1:-2].')')
+    return ""
 endfunction

File test/rtp/plugin/mappings.vim

 execute frawor#Setup('0.0', {'plugin/frawor/mappings': '0.0',
             \                       'plugin/mappings': '0.0',}, 1)
 function s:F.mapfunc(...)
-    return 'iargs: ('.string(a:000)[1:-2].")\e"
+    call WriteFile('args: ('.string(a:000)[1:-2].')')
+    return ""
 endfunction
-call s:_f.mapgroup.add('Mgroup', { 'alpha': {'rhs': 'α',
+call s:_f.mapgroup.add('Mgroup', { 'alpha': {'rhs': '<C-o>:W α<CR>',
             \                                'lhs': 'a',
             \                               'mode': 'i',},
-            \                       'beta': {'rhs': "aβ\e",
+            \                       'beta': {'rhs': ':<C-u>W β<CR>',
             \                                'lhs': 'a',},
-            \                      'gamma': {'rhs': 'aγ<Esc>',}})
-call s:_f.mapgroup.add('Mgroup2', {'delta': {'rhs': "δ",
+            \                      'gamma': {'rhs': ':<C-u>W γ<CR>',}})
+
+call s:_f.mapgroup.add('Mgroup2', {'delta': {'rhs': ':<C-u>W δ<CR>',
             \                                'lhs': 'd',},
-            \                    'epsilon': {'rhs': 'ε',}})
-call s:_f.mapgroup.add('Agroup', {  'zeta': {'rhs': 'ζ',
+            \                    'epsilon': {'rhs': ':<C-u>W ε<CR>',}})
+
+call s:_f.mapgroup.add('Agroup', {  'zeta': {'rhs': '<C-o>:W ζ<CR>zeta',
             \                                'lhs': 'f',},
-            \                        'eta': {'rhs': 'η',
+            \                        'eta': {'rhs': '<C-o>:W η<CR>eta',
             \                                'lhs': 0,},
             \}, {'type': 'abbr'})
+
 call s:_f.mapgroup.add('Mgroup3', { 'iota': {'rhs': ["%lhs", "%mode",
             \                                        ["def"], "%mgid",
             \                                        "%mname", ["abc"]],