Browse Source

Unit test updated.

Marco Bambini 8 years ago
parent
commit
8d8f00e019
2 changed files with 41 additions and 0 deletions
  1. 11 0
      test/unittest/list_remove.gravity
  2. 30 0
      test/unittest/register_protect.gravity

+ 11 - 0
test/unittest/list_remove.gravity

@@ -0,0 +1,11 @@
+#unittest {
+    name: "List remove.";
+    result: [20,30];
+};
+
+func main() {
+    var r = [10,20,30,40,50];
+    r.remove(0);
+    r.remove(3);
+    return r.remove(2);
+}

+ 30 - 0
test/unittest/register_protect.gravity

@@ -0,0 +1,30 @@
+#unittest {
+    name: "Register protection test.";
+    result: 3;
+};
+
+class Label {
+    var text;
+}
+
+class CollectionView {
+    var Label1;
+    
+    func DidSelectCell(p1, p2, p3) {
+        Label1.text = self.selectedItems().count;
+    }
+    
+    func selectedItems() {
+        return [1,2,3];
+    }
+    
+    func init() {
+        Label1 = Label();
+    }
+}
+
+func main() {
+    var CollectionView1 = CollectionView();
+    CollectionView1.DidSelectCell(0,0,0);
+    return CollectionView1.Label1.text;
+}