1
0
forked from aniani/vim

updated for version 7.2.336

Problem:    MzScheme interface can't evaluate an expression.
Solution:   Add mzeval(). (Sergey Khorev)
This commit is contained in:
Bram Moolenaar
2010-01-19 15:55:06 +01:00
parent 6d8027a6c2
commit 7e506b6a42
15 changed files with 359 additions and 22 deletions

View File

@@ -29,7 +29,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test42.out test52.out test65.out test66.out test67.out \
test68.out test69.out
SCRIPTS32 = test50.out
SCRIPTS32 = test50.out test70.out
SCRIPTS_GUI = test16.out

View File

@@ -48,7 +48,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test42.out test52.out test65.out test66.out test67.out \
test68.out test69.out
SCRIPTS32 = test50.out
SCRIPTS32 = test50.out test70.out
SCRIPTS_GUI = test16.out
@@ -78,6 +78,7 @@ clean:
-$(DEL) small.vim
-$(DEL) tiny.vim
-$(DEL) mbyte.vim
-$(DEL) mzscheme.vim
-$(DEL) X*
-$(DEL) viminfo

View File

@@ -23,7 +23,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test54.out test55.out test56.out test57.out test58.out \
test59.out test60.out test61.out test62.out test63.out \
test64.out test65.out test66.out test67.out test68.out \
test69.out
test69.out test70.out
SCRIPTS_GUI = test16.out
@@ -44,10 +44,10 @@ report:
$(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
clean:
-rm -rf *.out *.failed *.rej *.orig test.log tiny.vim small.vim mbyte.vim test.ok X* valgrind.pid* viminfo
-rm -rf *.out *.failed *.rej *.orig test.log tiny.vim small.vim mbyte.vim mzscheme.vim test.ok X* valgrind.pid* viminfo
test1.out: test1.in
-rm -f $*.failed tiny.vim small.vim mbyte.vim test.ok X* viminfo
-rm -f $*.failed tiny.vim small.vim mbyte.vim mzscheme.vim test.ok X* viminfo
$(VALGRIND) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in $*.in
@/bin/sh -c "if diff test.out $*.ok; \
then mv -f test.out $*.out; \

View File

@@ -32,11 +32,11 @@ gui: newlog $Scripts $ScriptsGUI
$Scripts $ScriptsGUI: $VimProg
clean:
:del {r}{force} *.out test.log tiny.vim small.vim mbyte.vim test.ok X*
:del {r}{force} *.out test.log tiny.vim small.vim mbyte.vim mzscheme.vim test.ok X*
# test1 is special, it checks for features
test1.out: test1.in
:del {force} test1.failed tiny.vim small.vim mbyte.vim
:del {force} test1.failed tiny.vim small.vim mbyte.vim mzscheme.vim
:sys {i} $VimProg -u unix.vim -U NONE --noplugin -s dotest.in test1.in
@if os.system("diff test.out test1.ok") != 0:
:error test1 FAILED - Something basic is wrong

View File

@@ -13,6 +13,7 @@ set like small.vim above. tiny.vim is sourced by tests that require the
If Vim was not compiled with the +multi_byte feature, the mbyte.vim script will be set like small.vim above. mbyte.vim is sourced by tests that require the
+multi_byte feature.
Similar logic is applied to the +mzscheme feature, using mzscheme.vim.
STARTTEST
:" Write a single line to test.out to check if testing works at all.
@@ -25,8 +26,11 @@ ae! test.ok
w! test.out
qa!
:w! mbyte.vim
:w! mzscheme.vim
:" If +multi_byte feature supported, make mbyte.vim empty.
:if has("multi_byte") | sp another | w! mbyte.vim | q | endif
:" If +mzscheme feature supported, make mzscheme.vim empty.
:if has("mzscheme") | sp another | w! mzscheme.vim | q | endif
:" If +eval feature supported quit here, leaving tiny.vim and small.vim empty.
:" Otherwise write small.vim to skip the test.
:if 1 | q! | endif

53
src/testdir/test70.in Normal file
View File

@@ -0,0 +1,53 @@
Smoke test for MzScheme interface and mzeval() function
STARTTEST
:so mzscheme.vim
:set nocompatible viminfo+=nviminfo
:function! MzRequire()
:redir => l:mzversion
:mz (version)
:redir END
:if strpart(l:mzversion, 1, 1) < "4"
:" MzScheme versions < 4.x:
:mz (require (prefix vim- vimext))
:else
:" newer versions:
:mz (require (prefix-in vim- 'vimext))
:mz (require r5rs)
:endif
:endfunction
:silent call MzRequire()
:mz (define l '("item0" "dictionary with list OK" "item2"))
:mz (define h (make-hash))
:mz (hash-set! h "list" l)
/^1
:" change buffer contents
:mz (vim-set-buff-line (vim-eval "line('.')") "1 changed line 1")
:" scalar test
:let tmp_string = mzeval('"string"')
:let tmp_1000 = mzeval('1000')
:if tmp_string . tmp_1000 == "string1000"
:let scalar_res = "OK"
:else
:let scalar_res = "FAILED"
:endif
:call append(search("^1"), "scalar test " . scalar_res)
:" dictionary containing a list
:let tmp = mzeval("h")["list"][1]
:/^2/put =tmp
:" circular list (at the same time test lists containing lists)
:mz (set-car! (cddr l) l)
:let l2 = mzeval("h")["list"]
:if l2[2] == l2
:let res = "OK"
:else
:let res = "FAILED"
:endif
:call setline(search("^3"), "circular test " . res)
:?^1?,$w! test.out
:qa!
ENDTEST
1 line 1
2 line 2
3 line 3

5
src/testdir/test70.ok Normal file
View File

@@ -0,0 +1,5 @@
1 changed line 1
scalar test OK
2 line 2
dictionary with list OK
circular test OK