vim-patch:8.2.0540: regexp and other code not tested (#20930)

Problem:    Regexp and other code not tested.
Solution:   Add more tests. (Yegappan Lakshmanan, closes vim/vim#5904)

004a6781b3
This commit is contained in:
zeertzjq 2022-11-04 19:31:58 +08:00 committed by GitHub
parent b854f2ce09
commit dce3fc3e9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 202 additions and 86 deletions

View File

@ -487,52 +487,6 @@ function Test_max_min_errors()
call assert_fails('call min(v:true)', 'min()') call assert_fails('call min(v:true)', 'min()')
endfunc endfunc
func Test_substitute_expr()
let g:val = 'XXX'
call assert_equal('XXX', substitute('yyy', 'y*', '\=g:val', ''))
call assert_equal('XXX', substitute('yyy', 'y*', {-> g:val}, ''))
call assert_equal("-\u1b \uf2-", substitute("-%1b %f2-", '%\(\x\x\)',
\ '\=nr2char("0x" . submatch(1))', 'g'))
call assert_equal("-\u1b \uf2-", substitute("-%1b %f2-", '%\(\x\x\)',
\ {-> nr2char("0x" . submatch(1))}, 'g'))
call assert_equal('231', substitute('123', '\(.\)\(.\)\(.\)',
\ {-> submatch(2) . submatch(3) . submatch(1)}, ''))
func Recurse()
return substitute('yyy', 'y\(.\)y', {-> submatch(1)}, '')
endfunc
" recursive call works
call assert_equal('-y-x-', substitute('xxx', 'x\(.\)x', {-> '-' . Recurse() . '-' . submatch(1) . '-'}, ''))
call assert_fails("let s=submatch([])", 'E745:')
call assert_fails("let s=submatch(2, [])", 'E745:')
endfunc
func Test_invalid_submatch()
" This was causing invalid memory access in Vim-7.4.2232 and older
call assert_fails("call substitute('x', '.', {-> submatch(10)}, '')", 'E935:')
endfunc
func Test_substitute_expr_arg()
call assert_equal('123456789-123456789=', substitute('123456789',
\ '\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)',
\ {m -> m[0] . '-' . m[1] . m[2] . m[3] . m[4] . m[5] . m[6] . m[7] . m[8] . m[9] . '='}, ''))
call assert_equal('123456-123456=789', substitute('123456789',
\ '\(.\)\(.\)\(.\)\(a*\)\(n*\)\(.\)\(.\)\(.\)\(x*\)',
\ {m -> m[0] . '-' . m[1] . m[2] . m[3] . m[4] . m[5] . m[6] . m[7] . m[8] . m[9] . '='}, ''))
call assert_equal('123456789-123456789x=', substitute('123456789',
\ '\(.\)\(.\)\(.*\)',
\ {m -> m[0] . '-' . m[1] . m[2] . m[3] . 'x' . m[4] . m[5] . m[6] . m[7] . m[8] . m[9] . '='}, ''))
call assert_fails("call substitute('xxx', '.', {m -> string(add(m, 'x'))}, '')", 'E742:')
call assert_fails("call substitute('xxx', '.', {m -> string(insert(m, 'x'))}, '')", 'E742:')
call assert_fails("call substitute('xxx', '.', {m -> string(extend(m, ['x']))}, '')", 'E742:')
call assert_fails("call substitute('xxx', '.', {m -> string(remove(m, 1))}, '')", 'E742:')
endfunc
func Test_function_with_funcref() func Test_function_with_funcref()
let s:f = function('type') let s:f = function('type')
let s:fref = function(s:f) let s:fref = function(s:f)

View File

@ -476,6 +476,10 @@ func Test_visual_increment_20()
exec "norm! \<C-A>" exec "norm! \<C-A>"
call assert_equal(["b"], getline(1, '$')) call assert_equal(["b"], getline(1, '$'))
call assert_equal([0, 1, 1, 0], getpos('.')) call assert_equal([0, 1, 1, 0], getpos('.'))
" decrement a and A and increment z and Z
call setline(1, ['a', 'A', 'z', 'Z'])
exe "normal 1G\<C-X>2G\<C-X>3G\<C-A>4G\<C-A>"
call assert_equal(['a', 'A', 'z', 'Z'], getline(1, '$'))
endfunc endfunc
" 21) block-wise increment on part of hexadecimal " 21) block-wise increment on part of hexadecimal
@ -566,12 +570,14 @@ endfunc
" 1) <ctrl-a> " 1) <ctrl-a>
" 0b11111111111111111111111111111111 " 0b11111111111111111111111111111111
func Test_visual_increment_26() func Test_visual_increment_26()
set nrformats+=alpha set nrformats+=bin
call setline(1, ["0b11111111111111111111111111111110"]) call setline(1, ["0b11111111111111111111111111111110"])
exec "norm! \<C-V>$\<C-A>" exec "norm! \<C-V>$\<C-A>"
call assert_equal(["0b11111111111111111111111111111111"], getline(1, '$')) call assert_equal(["0b11111111111111111111111111111111"], getline(1, '$'))
call assert_equal([0, 1, 1, 0], getpos('.')) call assert_equal([0, 1, 1, 0], getpos('.'))
set nrformats-=alpha exec "norm! \<C-V>$\<C-X>"
call assert_equal(["0b11111111111111111111111111111110"], getline(1, '$'))
set nrformats-=bin
endfunc endfunc
" 27) increment with 'rightreft', if supported " 27) increment with 'rightreft', if supported
@ -772,7 +778,6 @@ func Test_normal_increment_03()
endfunc endfunc
func Test_increment_empty_line() func Test_increment_empty_line()
new
call setline(1, ['0', '0', '0', '0', '0', '0', '']) call setline(1, ['0', '0', '0', '0', '0', '0', ''])
exe "normal Gvgg\<C-A>" exe "normal Gvgg\<C-A>"
call assert_equal(['1', '1', '1', '1', '1', '1', ''], getline(1, 7)) call assert_equal(['1', '1', '1', '1', '1', '1', ''], getline(1, 7))
@ -783,8 +788,13 @@ func Test_increment_empty_line()
exe "normal! c\<C-A>l" exe "normal! c\<C-A>l"
exe "normal! c\<C-X>l" exe "normal! c\<C-X>l"
call assert_equal('one two', getline(1)) call assert_equal('one two', getline(1))
endfunc
bwipe! " Try incrementing/decrementing a non-digit/alpha character
func Test_increment_special_char()
call setline(1, '!')
call assert_beeps("normal \<C-A>")
call assert_beeps("normal \<C-X>")
endfunc endfunc
" Try incrementing/decrementing a number when nrformats contains unsigned " Try incrementing/decrementing a number when nrformats contains unsigned

View File

@ -140,16 +140,15 @@ func Test_normal03_join()
$ $
:j 10 :j 10
call assert_equal('100', getline('.')) call assert_equal('100', getline('.'))
call assert_beeps('normal GVJ')
" clean up " clean up
bw! bw!
endfunc endfunc
" basic filter test
func Test_normal04_filter() func Test_normal04_filter()
" basic filter test
" only test on non windows platform " only test on non windows platform
if has('win32') CheckNotMSWindows
return
endif
call Setup_NewWindow() call Setup_NewWindow()
1 1
call feedkeys("!!sed -e 's/^/| /'\n", 'tx') call feedkeys("!!sed -e 's/^/| /'\n", 'tx')
@ -222,12 +221,10 @@ func Test_normal_formatexpr_returns_nonzero()
close! close!
endfunc endfunc
" basic test for formatprg
func Test_normal06_formatprg() func Test_normal06_formatprg()
" basic test for formatprg
" only test on non windows platform " only test on non windows platform
if has('win32') CheckNotMSWindows
return
endif
" uses sed to number non-empty lines " uses sed to number non-empty lines
call writefile(['#!/bin/sh', 'sed ''/./=''|sed ''/./{', 'N', 's/\n/ /', '}'''], 'Xsed_format.sh') call writefile(['#!/bin/sh', 'sed ''/./=''|sed ''/./{', 'N', 's/\n/ /', '}'''], 'Xsed_format.sh')
@ -240,16 +237,24 @@ func Test_normal06_formatprg()
set formatprg=./Xsed_format.sh set formatprg=./Xsed_format.sh
norm! gggqG norm! gggqG
call assert_equal(expected, getline(1, '$')) call assert_equal(expected, getline(1, '$'))
bw! %d
10new
call setline(1, text) call setline(1, text)
set formatprg=donothing set formatprg=donothing
setlocal formatprg=./Xsed_format.sh setlocal formatprg=./Xsed_format.sh
norm! gggqG norm! gggqG
call assert_equal(expected, getline(1, '$')) call assert_equal(expected, getline(1, '$'))
bw! %d
" Check for the command-line ranges added to 'formatprg'
set formatprg=cat
call setline(1, ['one', 'two', 'three', 'four', 'five'])
call feedkeys('gggqG', 'xt')
call assert_equal('.,$!cat', @:)
call feedkeys('2Ggq2j', 'xt')
call assert_equal('.,.+2!cat', @:)
bw!
" clean up " clean up
set formatprg= set formatprg=
setlocal formatprg= setlocal formatprg=
@ -263,18 +268,16 @@ func Test_normal07_internalfmt()
10new 10new
call setline(1, list) call setline(1, list)
set tw=12 set tw=12
norm! gggqG norm! ggVGgq
call assert_equal(['1 2 3', '4 5 6', '7 8 9', '10 11 '], getline(1, '$')) call assert_equal(['1 2 3', '4 5 6', '7 8 9', '10 11 '], getline(1, '$'))
" clean up " clean up
set tw=0 set tw=0
bw! bw!
endfunc endfunc
" basic tests for foldopen/folddelete
func Test_normal08_fold() func Test_normal08_fold()
" basic tests for foldopen/folddelete CheckFeature folding
if !has("folding")
return
endif
call Setup_NewWindow() call Setup_NewWindow()
50 50
setl foldenable fdm=marker setl foldenable fdm=marker
@ -1432,10 +1435,8 @@ func Test_normal18_z_fold()
endfunc endfunc
func Test_normal20_exmode() func Test_normal20_exmode()
if !has("unix")
" Reading from redirected file doesn't work on MS-Windows " Reading from redirected file doesn't work on MS-Windows
return CheckNotMSWindows
endif
call writefile(['1a', 'foo', 'bar', '.', 'w! Xfile2', 'q!'], 'Xscript') call writefile(['1a', 'foo', 'bar', '.', 'w! Xfile2', 'q!'], 'Xscript')
call writefile(['1', '2'], 'Xfile') call writefile(['1', '2'], 'Xfile')
call system(GetVimCommand() .. ' -e -s < Xscript Xfile') call system(GetVimCommand() .. ' -e -s < Xscript Xfile')
@ -2154,6 +2155,12 @@ func Test_normal31_r_cmd()
" r command should fail in operator pending mode " r command should fail in operator pending mode
call assert_beeps('normal! cr') call assert_beeps('normal! cr')
" replace a tab character in visual mode
%d
call setline(1, ["a\tb", "c\td", "e\tf"])
normal gglvjjrx
call assert_equal(['axx', 'xxx', 'xxf'], getline(1, '$'))
" clean up " clean up
set noautoindent set noautoindent
bw! bw!
@ -2178,9 +2185,7 @@ endfunc
" Test for g`, g;, g,, g&, gv, gk, gj, gJ, g0, g^, g_, gm, g$, gM, g CTRL-G, " Test for g`, g;, g,, g&, gv, gk, gj, gJ, g0, g^, g_, gm, g$, gM, g CTRL-G,
" gi and gI commands " gi and gI commands
func Test_normal33_g_cmd2() func Test_normal33_g_cmd2()
if !has("jumplist") CheckFeature jumplist
return
endif
call Setup_NewWindow() call Setup_NewWindow()
" Test for g` " Test for g`
clearjumps clearjumps
@ -2849,9 +2854,8 @@ func Test_normal49_counts()
endfunc endfunc
func Test_normal50_commandline() func Test_normal50_commandline()
if !has("timers") || !has("cmdline_hist") CheckFeature timers
return CheckFeature cmdline_hist
endif
func! DoTimerWork(id) func! DoTimerWork(id)
call assert_equal('[Command Line]', bufname('')) call assert_equal('[Command Line]', bufname(''))
" should fail, with E11, but does fail with E23? " should fail, with E11, but does fail with E23?
@ -2880,9 +2884,7 @@ func Test_normal50_commandline()
endfunc endfunc
func Test_normal51_FileChangedRO() func Test_normal51_FileChangedRO()
if !has("autocmd") CheckFeature autocmd
return
endif
call writefile(['foo'], 'Xreadonly.log') call writefile(['foo'], 'Xreadonly.log')
new Xreadonly.log new Xreadonly.log
setl ro setl ro
@ -2897,9 +2899,7 @@ func Test_normal51_FileChangedRO()
endfunc endfunc
func Test_normal52_rl() func Test_normal52_rl()
if !has("rightleft") CheckFeature rightleft
return
endif
new new
call setline(1, 'abcde fghij klmnopq') call setline(1, 'abcde fghij klmnopq')
norm! 1gg$ norm! 1gg$
@ -2932,9 +2932,7 @@ func Test_normal52_rl()
endfunc endfunc
func Test_normal53_digraph() func Test_normal53_digraph()
if !has('digraphs') CheckFeature digraphs
return
endif
new new
call setline(1, 'abcdefgh|') call setline(1, 'abcdefgh|')
exe "norm! 1gg0f\<c-k>!!" exe "norm! 1gg0f\<c-k>!!"
@ -3371,6 +3369,49 @@ func Test_normal_colon_op()
close! close!
endfunc endfunc
" Test for d and D commands
func Test_normal_delete_cmd()
new
" D in an empty line
call setline(1, '')
normal D
call assert_equal('', getline(1))
" D in an empty line in virtualedit mode
set virtualedit=all
normal D
call assert_equal('', getline(1))
set virtualedit&
" delete to a readonly register
call setline(1, ['abcd'])
call assert_beeps('normal ":d2l')
close!
endfunc
" Test for the 'E' flag in 'cpo' with yank, change, delete, etc. operators
func Test_empty_region_error()
new
call setline(1, '')
set cpo+=E
" yank an empty line
call assert_beeps('normal "ayl')
" change an empty line
call assert_beeps('normal lcTa')
" delete an empty line
call assert_beeps('normal D')
call assert_beeps('normal dl')
call assert_equal('', getline(1))
" change case of an empty line
call assert_beeps('normal gul')
call assert_beeps('normal gUl')
" replace a character
call assert_beeps('normal vrx')
" increment and decrement
call assert_beeps('exe "normal v\<C-A>"')
call assert_beeps('exe "normal v\<C-X>"')
set cpo-=E
close!
endfunc
" Test for deleting or changing characters across lines with 'whichwrap' " Test for deleting or changing characters across lines with 'whichwrap'
" containing 's'. Should count <EOL> as one character. " containing 's'. Should count <EOL> as one character.
func Test_normal_op_across_lines() func Test_normal_op_across_lines()

View File

@ -146,6 +146,10 @@ func Test_regexp_single_line_pat()
call add(tl, [2, 'c*', 'abdef', '']) call add(tl, [2, 'c*', 'abdef', ''])
call add(tl, [2, 'bc\+', 'abccccdef', 'bcccc']) call add(tl, [2, 'bc\+', 'abccccdef', 'bcccc'])
call add(tl, [2, 'bc\+', 'abdef']) " no match call add(tl, [2, 'bc\+', 'abdef']) " no match
" match escape character in a string
call add(tl, [2, '.\e.', "one\<Esc>two", "e\<Esc>t"])
" match backspace character in a string
call add(tl, [2, '.\b.', "one\<C-H>two", "e\<C-H>t"])
" match newline character in a string " match newline character in a string
call add(tl, [2, 'o\nb', "foo\nbar", "o\nb"]) call add(tl, [2, 'o\nb', "foo\nbar", "o\nb"])
@ -895,6 +899,8 @@ func Test_regexp_error()
call assert_fails("call matchlist('x x', '\\%#=2 \\zs*')", 'E888:') call assert_fails("call matchlist('x x', '\\%#=2 \\zs*')", 'E888:')
call assert_fails("call matchlist('x x', '\\%#=2 \\ze*')", 'E888:') call assert_fails("call matchlist('x x', '\\%#=2 \\ze*')", 'E888:')
call assert_fails('exe "normal /\\%#=1\\%[x\\%[x]]\<CR>"', 'E369:') call assert_fails('exe "normal /\\%#=1\\%[x\\%[x]]\<CR>"', 'E369:')
call assert_fails("call matchstr('abcd', '\\%o841\\%o142')", 'E678:')
call assert_equal('', matchstr('abcd', '\%o181\%o142'))
endfunc endfunc
" Test for using the last substitute string pattern (~) " Test for using the last substitute string pattern (~)

View File

@ -1752,6 +1752,25 @@ func Test_invalid_regexp()
call assert_fails("call search('\\%#=3ab')", 'E864:') call assert_fails("call search('\\%#=3ab')", 'E864:')
endfunc endfunc
" Test for searching a very complex pattern in a string. Should switch the
" regexp engine from NFA to the old engine.
func Test_regexp_switch_engine()
let l = readfile('samples/re.freeze.txt')
let v = substitute(l[4], '..\@<!', '', '')
call assert_equal(l[4], v)
endfunc
" Test for the \%V atom to search within visually selected text
func Test_search_in_visual_area()
new
call setline(1, ['foo bar1', 'foo bar2', 'foo bar3', 'foo bar4'])
exe "normal 2GVjo/\\%Vbar\<CR>\<Esc>"
call assert_equal([2, 5], [line('.'), col('.')])
exe "normal 2GVj$?\\%Vbar\<CR>\<Esc>"
call assert_equal([3, 5], [line('.'), col('.')])
close!
endfunc
" Test for searching with 'smartcase' and 'ignorecase' " Test for searching with 'smartcase' and 'ignorecase'
func Test_search_smartcase() func Test_search_smartcase()
new new

View File

@ -493,6 +493,9 @@ func Test_sub_replace_1()
call assert_equal("x\<C-M>x", substitute('xXx', 'X', "\r", '')) call assert_equal("x\<C-M>x", substitute('xXx', 'X', "\r", ''))
call assert_equal("YyyY", substitute('Y', 'Y', '\L\uyYy\l\EY', '')) call assert_equal("YyyY", substitute('Y', 'Y', '\L\uyYy\l\EY', ''))
call assert_equal("zZZz", substitute('Z', 'Z', '\U\lZzZ\u\Ez', '')) call assert_equal("zZZz", substitute('Z', 'Z', '\U\lZzZ\u\Ez', ''))
" \v or \V after $
call assert_equal('abxx', substitute('abcd', 'xy$\v|cd$', 'xx', ''))
call assert_equal('abxx', substitute('abcd', 'xy$\V\|cd\$', 'xx', ''))
endfunc endfunc
func Test_sub_replace_2() func Test_sub_replace_2()
@ -867,6 +870,40 @@ endfunc
func Test_substitute() func Test_substitute()
call assert_equal('aaaa', substitute('', '\zs', 'a', 'g')) call assert_equal('aaaa', substitute('', '\zs', 'a', 'g'))
" Substitute with special keys
call assert_equal("a\<End>c", substitute('abc', "a.c", "a\<End>c", ''))
endfunc
func Test_substitute_expr()
let g:val = 'XXX'
call assert_equal('XXX', substitute('yyy', 'y*', '\=g:val', ''))
call assert_equal('XXX', substitute('yyy', 'y*', {-> g:val}, ''))
call assert_equal("-\u1b \uf2-", substitute("-%1b %f2-", '%\(\x\x\)',
\ '\=nr2char("0x" . submatch(1))', 'g'))
call assert_equal("-\u1b \uf2-", substitute("-%1b %f2-", '%\(\x\x\)',
\ {-> nr2char("0x" . submatch(1))}, 'g'))
call assert_equal('231', substitute('123', '\(.\)\(.\)\(.\)',
\ {-> submatch(2) . submatch(3) . submatch(1)}, ''))
func Recurse()
return substitute('yyy', 'y\(.\)y', {-> submatch(1)}, '')
endfunc
" recursive call works
call assert_equal('-y-x-', substitute('xxx', 'x\(.\)x', {-> '-' . Recurse() . '-' . submatch(1) . '-'}, ''))
call assert_fails("let s=submatch([])", 'E745:')
call assert_fails("let s=submatch(2, [])", 'E745:')
endfunc
func Test_invalid_submatch()
" This was causing invalid memory access in Vim-7.4.2232 and older
call assert_fails("call substitute('x', '.', {-> submatch(10)}, '')", 'E935:')
call assert_fails('eval submatch(-1)', 'E935:')
call assert_equal('', submatch(0))
call assert_equal('', submatch(1))
call assert_equal([], submatch(0, 1))
call assert_equal([], submatch(1, 1))
endfunc endfunc
func Test_submatch_list_concatenate() func Test_submatch_list_concatenate()
@ -875,6 +912,44 @@ func Test_submatch_list_concatenate()
call substitute('A1', pat, Rep, '')->assert_equal("[['A1'], ['1']]") call substitute('A1', pat, Rep, '')->assert_equal("[['A1'], ['1']]")
endfunc endfunc
func Test_substitute_expr_arg()
call assert_equal('123456789-123456789=', substitute('123456789',
\ '\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)',
\ {m -> m[0] . '-' . m[1] . m[2] . m[3] . m[4] . m[5] . m[6] . m[7] . m[8] . m[9] . '='}, ''))
call assert_equal('123456-123456=789', substitute('123456789',
\ '\(.\)\(.\)\(.\)\(a*\)\(n*\)\(.\)\(.\)\(.\)\(x*\)',
\ {m -> m[0] . '-' . m[1] . m[2] . m[3] . m[4] . m[5] . m[6] . m[7] . m[8] . m[9] . '='}, ''))
call assert_equal('123456789-123456789x=', substitute('123456789',
\ '\(.\)\(.\)\(.*\)',
\ {m -> m[0] . '-' . m[1] . m[2] . m[3] . 'x' . m[4] . m[5] . m[6] . m[7] . m[8] . m[9] . '='}, ''))
call assert_fails("call substitute('xxx', '.', {m -> string(add(m, 'x'))}, '')", 'E742:')
call assert_fails("call substitute('xxx', '.', {m -> string(insert(m, 'x'))}, '')", 'E742:')
call assert_fails("call substitute('xxx', '.', {m -> string(extend(m, ['x']))}, '')", 'E742:')
call assert_fails("call substitute('xxx', '.', {m -> string(remove(m, 1))}, '')", 'E742:')
endfunc
" Test for using a function to supply the substitute string
func Test_substitute_using_func()
func Xfunc()
return '1234'
endfunc
call assert_equal('a1234f', substitute('abcdef', 'b..e',
\ function("Xfunc"), ''))
delfunc Xfunc
endfunc
" Test for using submatch() with a multiline match
func Test_substitute_multiline_submatch()
new
call setline(1, ['line1', 'line2', 'line3', 'line4'])
%s/^line1\(\_.\+\)line4$/\=submatch(1)/
call assert_equal(['', 'line2', 'line3', ''], getline(1, '$'))
close!
endfunc
func Test_substitute_skipped_range() func Test_substitute_skipped_range()
new new
if 0 if 0

View File

@ -346,6 +346,17 @@ func Test_yank_paste_small_del_reg()
set virtualedit= set virtualedit=
endfunc endfunc
" Test for delete that breaks a tab into spaces
func Test_delete_break_tab()
new
call setline(1, "one\ttwo")
set virtualedit=all
normal v3ld
call assert_equal(' two', getline(1))
set virtualedit&
close!
endfunc
" After calling s:TryVirtualeditReplace(), line 1 will contain one of these " After calling s:TryVirtualeditReplace(), line 1 will contain one of these
" two strings, depending on whether virtual editing is on or off. " two strings, depending on whether virtual editing is on or off.
let s:result_ve_on = 'a x' let s:result_ve_on = 'a x'

View File

@ -7,7 +7,7 @@ local clear, command = helpers.clear, helpers.command
-- Temporary file for gathering benchmarking results for each regexp engine. -- Temporary file for gathering benchmarking results for each regexp engine.
local result_file = 'benchmark.out' local result_file = 'benchmark.out'
-- Fixture containing an HTML fragment that can make a search appear to freeze. -- Fixture containing an HTML fragment that can make a search appear to freeze.
local sample_file = 'test/benchmark/samples/re.freeze.txt' local sample_file = 'src/nvim/testdir/samples/re.freeze.txt'
-- Vim script code that does both the work and the benchmarking of that work. -- Vim script code that does both the work and the benchmarking of that work.
local measure_cmd = local measure_cmd =