diff src/testdir/test_vim9_class.vim @ 31706:824fc05d9571 v9.0.1185

patch 9.0.1185: using class from imported script not tested Commit: https://github.com/vim/vim/commit/a86655af84f1596f0f3ef22813724fe06f1e4809 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 12 17:06:27 2023 +0000 patch 9.0.1185: using class from imported script not tested Problem: Using class from imported script not tested. Solution: Add tests. Implement what is missing.
author Bram Moolenaar <Bram@vim.org>
date Thu, 12 Jan 2023 18:15:05 +0100
parents 69ee530cac28
children f6309f6742e5
line wrap: on
line diff
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -974,5 +974,27 @@ def Test_class_extends()
   v9.CheckScriptSuccess(lines)
 enddef
 
+def Test_class_import()
+  var lines =<< trim END
+      vim9script
+      export class Animal
+        this.kind: string
+        this.name: string
+      endclass
+  END
+  writefile(lines, 'Xanimal.vim', 'D')
+
+  lines =<< trim END
+      vim9script
+      import './Xanimal.vim' as animal
+
+      var a: animal.Animal
+      a = animal.Animal.new('fish', 'Eric')
+      assert_equal('fish', a.kind)
+      assert_equal('Eric', a.name)
+  END
+  v9.CheckScriptSuccess(lines)
+enddef
+
 
 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker