annotate src/testdir/test_netbeans.vim @ 17049:f38fcbf343ce v8.1.1524

patch 8.1.1524: tests are silently skipped commit https://github.com/vim/vim/commit/b0f94c1ff34d27d33aa9f96204985ea29c2eb0a1 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 13 22:19:53 2019 +0200 patch 8.1.1524: tests are silently skipped Problem: Tests are silently skipped. Solution: Throw an exception for skipped tests in more places.
author Bram Moolenaar <Bram@vim.org>
date Thu, 13 Jun 2019 22:30:07 +0200
parents cd6daebf47ae
children 8e9e9124c7a2
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')
17049
f38fcbf343ce patch 8.1.1524: tests are silently skipped
Bram Moolenaar <Bram@vim.org>
parents: 15077
diff changeset
4 throw 'Skipped, netbeans_intg feature missing'
9517
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 == ''
17049
f38fcbf343ce patch 8.1.1524: tests are silently skipped
Bram Moolenaar <Bram@vim.org>
parents: 15077
diff changeset
11 throw 'Skipped, python program missing'
9517
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 endif
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 " 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
15 func s:run_server(testfunc, ...)
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 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
17 endfunc
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 func Nb_basic(port)
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call delete("Xnetbeans")
12742
af961e38e508 patch 8.0.1249: no error when WaitFor() gets an invalid wrong expression
Christian Brabandt <cb@256bit.org>
parents: 12734
diff changeset
21 call writefile([], "Xnetbeans")
15077
cd6daebf47ae patch 8.1.0549: netbeans test depends on README.txt contents
Bram Moolenaar <Bram@vim.org>
parents: 12742
diff changeset
22 call writefile(repeat(['abcdefghijklmnopqrstuvwxyz'], 5), "XREADME.txt")
9517
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 exe 'nbstart :localhost:' . a:port . ':bunny'
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call assert_true(has("netbeans_enabled"))
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call WaitFor('len(readfile("Xnetbeans")) > 2')
15077
cd6daebf47ae patch 8.1.0549: netbeans test depends on README.txt contents
Bram Moolenaar <Bram@vim.org>
parents: 12742
diff changeset
27 split +$ XREADME.txt
9517
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28
15077
cd6daebf47ae patch 8.1.0549: netbeans test depends on README.txt contents
Bram Moolenaar <Bram@vim.org>
parents: 12742
diff changeset
29 " Opening XREADME.txt will result in a setDot command
9517
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call WaitFor('len(readfile("Xnetbeans")) > 4')
12734
810a4c3d4f7e patch 8.0.1245: when WaitFor() has a wrong expression it just waits a second
Christian Brabandt <cb@256bit.org>
parents: 10253
diff changeset
31 call WaitFor('getcurpos()[1] == 3')
9517
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 let pos = getcurpos()
10162
663ef672c4b9 commit https://github.com/vim/vim/commit/ff330ff2c4500dc5535631418d601194654e4536
Christian Brabandt <cb@256bit.org>
parents: 9996
diff changeset
33 call assert_equal(3, pos[1])
9517
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call assert_equal(20, pos[2])
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 close
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 nbclose
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call WaitFor('len(readfile("Xnetbeans")) > 6')
10253
a92c4abb8c1f commit https://github.com/vim/vim/commit/8ddef48d1eade1911b946fdda8c73c80856e6273
Christian Brabandt <cb@256bit.org>
parents: 10162
diff changeset
39 call assert_false(has("netbeans_enabled"))
9517
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 let lines = readfile("Xnetbeans")
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call assert_equal('AUTH bunny', lines[0])
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 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
43 call assert_equal('0:startupDone=0', lines[2])
15077
cd6daebf47ae patch 8.1.0549: netbeans test depends on README.txt contents
Bram Moolenaar <Bram@vim.org>
parents: 12742
diff changeset
44 call assert_equal('0:fileOpened=0 "XREADME.txt" T F', substitute(lines[3], '".*/', '"', ''))
9517
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 assert_equal('0:disconnect=1', lines[6])
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 call delete("Xnetbeans")
15077
cd6daebf47ae patch 8.1.0549: netbeans test depends on README.txt contents
Bram Moolenaar <Bram@vim.org>
parents: 12742
diff changeset
49 call delete("XREADME.txt")
9517
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 endfunc
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 func Test_nb_basic()
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 call ch_log('Test_nb_basic')
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 call s:run_server('Nb_basic')
9f8f03a44886 commit https://github.com/vim/vim/commit/321efdd77a7b9ac11ade90dd7634b5d37f4820fe
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 endfunc
9521
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
56
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
57 func Nb_file_auth(port)
12742
af961e38e508 patch 8.0.1249: no error when WaitFor() gets an invalid wrong expression
Christian Brabandt <cb@256bit.org>
parents: 12734
diff changeset
58 call delete("Xnetbeans")
af961e38e508 patch 8.0.1249: no error when WaitFor() gets an invalid wrong expression
Christian Brabandt <cb@256bit.org>
parents: 12734
diff changeset
59 call writefile([], "Xnetbeans")
af961e38e508 patch 8.0.1249: no error when WaitFor() gets an invalid wrong expression
Christian Brabandt <cb@256bit.org>
parents: 12734
diff changeset
60
9521
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
61 call assert_fails('nbstart =notexist', 'E660:')
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
62 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
63 if has('unix')
20e7be5d99ac commit https://github.com/vim/vim/commit/53bdec2ac9b994eee9c60f2ab9ad8a8afb2b9594
Christian Brabandt <cb@256bit.org>
parents: 9521
diff changeset
64 call setfperm('Xnbauth', "rw-r--r--")
20e7be5d99ac commit https://github.com/vim/vim/commit/53bdec2ac9b994eee9c60f2ab9ad8a8afb2b9594
Christian Brabandt <cb@256bit.org>
parents: 9521
diff changeset
65 call assert_fails('nbstart =Xnbauth', 'E668:')
20e7be5d99ac commit https://github.com/vim/vim/commit/53bdec2ac9b994eee9c60f2ab9ad8a8afb2b9594
Christian Brabandt <cb@256bit.org>
parents: 9521
diff changeset
66 endif
9521
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
67 call setfperm('Xnbauth', "rw-------")
9996
c2968473c8dc commit https://github.com/vim/vim/commit/ffdf08c94e16b0813862bdfdbc1c92892d2e4c93
Christian Brabandt <cb@256bit.org>
parents: 9663
diff changeset
68 exe 'nbstart =Xnbauth'
9521
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
69 call assert_true(has("netbeans_enabled"))
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
70
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
71 call WaitFor('len(readfile("Xnetbeans")) > 2')
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
72 nbclose
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
73 let lines = readfile("Xnetbeans")
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
74 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
75 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
76 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
77
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
78 call delete("Xnbauth")
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
79 call delete("Xnetbeans")
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
80 endfunc
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
81
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
82 func Test_nb_file_auth()
820c8861d15c commit https://github.com/vim/vim/commit/603d657219154ef074eeb70f6892b0b54e4fc19b
Christian Brabandt <cb@256bit.org>
parents: 9517
diff changeset
83 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
84 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
85 endfunc