comparison src/testdir/test_vim9_class.vim @ 31635:5c1b7a87466e v9.0.1150

patch 9.0.1150: :interface is not implemented yet Commit: https://github.com/vim/vim/commit/554d0313022c3977c71f7dcbc5c841ef43d988a6 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 5 19:59:18 2023 +0000 patch 9.0.1150: :interface is not implemented yet Problem: :interface is not implemented yet. Solution: Implement the basics of :interface.
author Bram Moolenaar <Bram@vim.org>
date Thu, 05 Jan 2023 21:00:06 +0100
parents d19377e0a0b4
children 62237ea155d9
comparison
equal deleted inserted replaced
31634:40a31588b97c 31635:5c1b7a87466e
550 assert_equal("object of TextPosition {lnum: 1, col: 22}", string(pos)) 550 assert_equal("object of TextPosition {lnum: 1, col: 22}", string(pos))
551 END 551 END
552 v9.CheckScriptSuccess(lines) 552 v9.CheckScriptSuccess(lines)
553 enddef 553 enddef
554 554
555 def Test_interface_basics()
556 var lines =<< trim END
557 vim9script
558 interface Something
559 this.value: string
560 static count: number
561 def GetCount(): number
562 endinterface
563 END
564 v9.CheckScriptSuccess(lines)
565
566 lines =<< trim END
567 interface SomethingWrong
568 static count = 7
569 endinterface
570 END
571 v9.CheckScriptFailure(lines, 'E1342:')
572
573 lines =<< trim END
574 vim9script
575
576 interface Some
577 static count: number
578 def Method(count: number)
579 endinterface
580 END
581 # TODO: this should give an error for "count" shadowing
582 v9.CheckScriptSuccess(lines)
583
584 lines =<< trim END
585 vim9script
586 interface somethingWrong
587 static count = 7
588 endinterface
589 END
590 v9.CheckScriptFailure(lines, 'E1343: Interface name must start with an uppercase letter: somethingWrong')
591
592 lines =<< trim END
593 vim9script
594 interface SomethingWrong
595 this.value: string
596 static count = 7
597 def GetCount(): number
598 endinterface
599 END
600 v9.CheckScriptFailure(lines, 'E1344:')
601
602 lines =<< trim END
603 vim9script
604 interface SomethingWrong
605 this.value: string
606 static count: number
607 def GetCount(): number
608 return 5
609 enddef
610 endinterface
611 END
612 v9.CheckScriptFailure(lines, 'E1345: Not a valid command in an interface: return 5')
613 enddef
614
555 615
556 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker 616 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker