Mercurial > vim
annotate src/testdir/test70.in @ 21305:91d4af3309e7 v8.2.1203
patch 8.2.1203: unused assignments in expression evaluation
Commit: https://github.com/vim/vim/commit/3ac9c4701a5f1e39303ca2885956db92215966db
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jul 13 21:28:03 2020 +0200
patch 8.2.1203: unused assignments in expression evaluation
Problem: Unused assignments in expression evaluation.
Solution: Move declarations and assignments to inner blocks where possible.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 13 Jul 2020 21:30:04 +0200 |
parents | 0cdb6ac20748 |
children |
rev | line source |
---|---|
2050 | 1 Smoke test for MzScheme interface and mzeval() function |
2 | |
3 STARTTEST | |
4 :so mzscheme.vim | |
5 :set nocompatible viminfo+=nviminfo | |
6 :function! MzRequire() | |
7 :redir => l:mzversion | |
8 :mz (version) | |
9 :redir END | |
10 :if strpart(l:mzversion, 1, 1) < "4" | |
11 :" MzScheme versions < 4.x: | |
12 :mz (require (prefix vim- vimext)) | |
13 :else | |
14 :" newer versions: | |
15 :mz (require (prefix-in vim- 'vimext)) | |
16 :mz (require r5rs) | |
17 :endif | |
18 :endfunction | |
19 :silent call MzRequire() | |
20 :mz (define l '("item0" "dictionary with list OK" "item2")) | |
21 :mz (define h (make-hash)) | |
22 :mz (hash-set! h "list" l) | |
23 /^1 | |
24 :" change buffer contents | |
25 :mz (vim-set-buff-line (vim-eval "line('.')") "1 changed line 1") | |
26 :" scalar test | |
27 :let tmp_string = mzeval('"string"') | |
17930
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
4088
diff
changeset
|
28 :let tmp_1000 = '1000'->mzeval() |
2050 | 29 :if tmp_string . tmp_1000 == "string1000" |
30 :let scalar_res = "OK" | |
31 :else | |
32 :let scalar_res = "FAILED" | |
33 :endif | |
34 :call append(search("^1"), "scalar test " . scalar_res) | |
35 :" dictionary containing a list | |
36 :let tmp = mzeval("h")["list"][1] | |
37 :/^2/put =tmp | |
38 :" circular list (at the same time test lists containing lists) | |
39 :mz (set-car! (cddr l) l) | |
40 :let l2 = mzeval("h")["list"] | |
4088 | 41 :if l2[2] == l2 |
2050 | 42 :let res = "OK" |
43 :else | |
4074 | 44 :let res = "FAILED: " . l2[2] |
2050 | 45 :endif |
46 :call setline(search("^3"), "circular test " . res) | |
4074 | 47 :" funcrefs |
48 :mz (define vim:max (vim-eval "function('max')")) | |
49 :mz (define m (vim:max '(1 100 8))) | |
50 :let m = mzeval('m') | |
51 :if m == 100 | |
52 :let fref_res = "OK" | |
53 :else | |
54 :let fref_res = "FAILED: " . m | |
55 :end | |
56 :call append(line('$'), 'funcrefs '. fref_res) | |
2050 | 57 :?^1?,$w! test.out |
58 :qa! | |
59 ENDTEST | |
60 | |
61 1 line 1 | |
62 2 line 2 | |
63 3 line 3 |