Sfoglia il codice sorgente

Unit test for the new forbid bind to core class addendum.

Marco Bambini 8 anni fa
parent
commit
7680e400cd
1 ha cambiato i file con 17 aggiunte e 0 eliminazioni
  1. 17 0
      test/core_bind.gravity

+ 17 - 0
test/core_bind.gravity

@@ -0,0 +1,17 @@
+#unittest {
+	name: "Forbid bind on core classes.";
+	error: RUNTIME;
+};
+
+class foo {
+	func f1() {return 10;}
+}
+
+func main() {
+	var obj = foo();
+	var n1 = obj.f1();
+
+	func test() {return 1000;}
+	Int.bind("test", test);
+
+}