annotate src/testdir/test_netbeans.vim @ 9663:27d3250c6dd4 v7.4.2108

commit https://github.com/vim/vim/commit/adfc5c2f9cf8032e496fcd4793d829768bd6d0a7 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 27 22:56:48 2016 +0200 patch 7.4.2108 Problem: Netbeans test is flaky. Solution: Wait for the cursor to be positioned.
author Christian Brabandt <cb@256bit.org>
date Wed, 27 Jul 2016 23:00:07 +0200
parents 20e7be5d99ac
children c2968473c8dc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9517
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test the netbeans interface.
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 if !has('netbeans_intg')
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 finish
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 endif
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 source shared.vim
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 let s:python = PythonProg()
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 if s:python == ''
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 " Can't run this test.
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 finish
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 endif
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 " Run "testfunc" after sarting the server and stop the server afterwards.
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 func s:run_server(testfunc, ...)
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call RunServer('test_netbeans.py', a:testfunc, a:000)
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 endfunc
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 func Nb_basic(port)
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call delete("Xnetbeans")
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 exe 'nbstart :localhost:' . a:port . ':bunny'
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call assert_true(has("netbeans_enabled"))
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call WaitFor('len(readfile("Xnetbeans")) > 2')
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 split +$ Makefile
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 " Opening Makefile will result in a setDot command
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 call WaitFor('len(readfile("Xnetbeans")) > 4')
9663
27d3250c6dd4 commit https://github.com/vim/vim/commit/adfc5c2f9cf8032e496fcd4793d829768bd6d0a7
Christian Brabandt <cb@256bit.org>
parents: 9603
diff changeset
30 call WaitFor('getcurpos()[1] == 2')
9517
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 let pos = getcurpos()
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_equal(2, pos[1])
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 call assert_equal(20, pos[2])
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 close
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 nbclose
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 call WaitFor('len(readfile("Xnetbeans")) > 6')
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 let lines = readfile("Xnetbeans")
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 call assert_equal('AUTH bunny', lines[0])
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 call assert_equal('0:version=0 "2.5"', lines[1])
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call assert_equal('0:startupDone=0', lines[2])
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 call assert_equal('0:fileOpened=0 "Makefile" T F', substitute(lines[3], '".*/', '"', ''))
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call assert_equal('0:disconnect=1', lines[6])
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 call delete("Xnetbeans")
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 endfunc
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 func Test_nb_basic()
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 call ch_log('Test_nb_basic')
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 call s:run_server('Nb_basic')
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 endfunc
9521
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
53
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
54 func Nb_file_auth(port)
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
55 call assert_fails('nbstart =notexist', 'E660:')
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
56 call writefile(['host=localhost', 'port=' . a:port, 'auth=bunny'], 'Xnbauth')
9603
20e7be5d99ac commit https://github.com/vim/vim/commit/53bdec2ac9b994eee9c60f2ab9ad8a8afb2b9594
Christian Brabandt <cb@256bit.org>
parents: 9521
diff changeset
57 if has('unix')
20e7be5d99ac commit https://github.com/vim/vim/commit/53bdec2ac9b994eee9c60f2ab9ad8a8afb2b9594
Christian Brabandt <cb@256bit.org>
parents: 9521
diff changeset
58 call setfperm('Xnbauth', "rw-r--r--")
20e7be5d99ac commit https://github.com/vim/vim/commit/53bdec2ac9b994eee9c60f2ab9ad8a8afb2b9594
Christian Brabandt <cb@256bit.org>
parents: 9521
diff changeset
59 call assert_fails('nbstart =Xnbauth', 'E668:')
20e7be5d99ac commit https://github.com/vim/vim/commit/53bdec2ac9b994eee9c60f2ab9ad8a8afb2b9594
Christian Brabandt <cb@256bit.org>
parents: 9521
diff changeset
60 endif
9521
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
61 call setfperm('Xnbauth', "rw-------")
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
62 exe 'nbstart :localhost:' . a:port . ':bunny'
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
63 call assert_true(has("netbeans_enabled"))
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
64
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
65 call WaitFor('len(readfile("Xnetbeans")) > 2')
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
66 nbclose
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
67 let lines = readfile("Xnetbeans")
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
68 call assert_equal('AUTH bunny', lines[0])
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
69 call assert_equal('0:version=0 "2.5"', lines[1])
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
70 call assert_equal('0:startupDone=0', lines[2])
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
71
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
72 call delete("Xnbauth")
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
73 call delete("Xnetbeans")
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
74 endfunc
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
75
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
76 func Test_nb_file_auth()
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
77 call ch_log('Test_nb_file_auth')
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
78 call s:run_server('Nb_file_auth')
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
79 endfunc