1" Test the netbeans interface. 2 3if !has('netbeans_intg') 4 finish 5endif 6 7source shared.vim 8 9let s:python = PythonProg() 10if s:python == '' 11 " Can't run this test. 12 finish 13endif 14 15" Run "testfunc" after sarting the server and stop the server afterwards. 16func s:run_server(testfunc, ...) 17 call RunServer('test_netbeans.py', a:testfunc, a:000) 18endfunc 19 20func Nb_basic(port) 21 call delete("Xnetbeans") 22 call writefile([], "Xnetbeans") 23 exe 'nbstart :localhost:' . a:port . ':bunny' 24 call assert_true(has("netbeans_enabled")) 25 26 call WaitFor('len(readfile("Xnetbeans")) > 2') 27 split +$ README.txt 28 29 " Opening README.txt will result in a setDot command 30 call WaitFor('len(readfile("Xnetbeans")) > 4') 31 call WaitFor('getcurpos()[1] == 3') 32 let pos = getcurpos() 33 call assert_equal(3, pos[1]) 34 call assert_equal(20, pos[2]) 35 close 36 nbclose 37 38 call WaitFor('len(readfile("Xnetbeans")) > 6') 39 call assert_false(has("netbeans_enabled")) 40 let lines = readfile("Xnetbeans") 41 call assert_equal('AUTH bunny', lines[0]) 42 call assert_equal('0:version=0 "2.5"', lines[1]) 43 call assert_equal('0:startupDone=0', lines[2]) 44 call assert_equal('0:fileOpened=0 "README.txt" T F', substitute(lines[3], '".*/', '"', '')) 45 46 call assert_equal('0:disconnect=1', lines[6]) 47 48 call delete("Xnetbeans") 49endfunc 50 51func Test_nb_basic() 52 call ch_log('Test_nb_basic') 53 call s:run_server('Nb_basic') 54endfunc 55 56func Nb_file_auth(port) 57 call delete("Xnetbeans") 58 call writefile([], "Xnetbeans") 59 60 call assert_fails('nbstart =notexist', 'E660:') 61 call writefile(['host=localhost', 'port=' . a:port, 'auth=bunny'], 'Xnbauth') 62 if has('unix') 63 call setfperm('Xnbauth', "rw-r--r--") 64 call assert_fails('nbstart =Xnbauth', 'E668:') 65 endif 66 call setfperm('Xnbauth', "rw-------") 67 exe 'nbstart =Xnbauth' 68 call assert_true(has("netbeans_enabled")) 69 70 call WaitFor('len(readfile("Xnetbeans")) > 2') 71 nbclose 72 let lines = readfile("Xnetbeans") 73 call assert_equal('AUTH bunny', lines[0]) 74 call assert_equal('0:version=0 "2.5"', lines[1]) 75 call assert_equal('0:startupDone=0', lines[2]) 76 77 call delete("Xnbauth") 78 call delete("Xnetbeans") 79endfunc 80 81func Test_nb_file_auth() 82 call ch_log('Test_nb_file_auth') 83 call s:run_server('Nb_file_auth') 84endfunc 85