Explorar el Código

Add tests for incdec and object instanciation

pull/7/head
mtardy hace 4 años
padre
commit
8a245b3f00
Se han modificado 2 ficheros con 72 adiciones y 0 borrados
  1. +43
    -0
      test-incdec.txt
  2. +29
    -0
      test-object.txt

+ 43
- 0
test-incdec.txt Ver fichero

@ -0,0 +1,43 @@
var a = { x: 42};
a.x;
++a.x;
a.x;
++a[#"x"];
a.x;
var b = 666;
b;
++b;
b;
a.x;
a.x++;
a.x;
a[#"x"]++;
a.x;
b;
b++;
b;
a.x;
--a.x;
a.x;
--a[#"x"];
a.x;
var b = 666;
b;
--b;
b;
a.x;
a.x--;
a.x;
a[#"x"]--;
a.x;
b;
b--;
b;

+ 29
- 0
test-object.txt Ver fichero

@ -0,0 +1,29 @@
var Object = { __name__: #"Object" };
print("Object is ", Object);
var Point = { __name__: #"Point", __proto__ : Object };
print("Point is ", Point);
Object.new = fun () {
print("ARGS are ", __arguments__);
var obj= { __proto__ : this };
var init= this.init;
print("INIT is ", init);
init && invoke(null, obj, init, __arguments__);
obj;
};
print("Object.new is ", Object.new);
print("Point.new is ", Point.new);
print("Object.new() is ", Object.new());
Point.init = fun (x, y) {
this.x = x;
this.y = y;
}
print("Point.new(3, 4) is ", Point.new(3, 4));

Cargando…
Cancelar
Guardar