Skip to content

Commit

Permalink
Add test for getting keys of object prototypes
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Livesey committed Jul 1, 2024
1 parent 8ccd2b3 commit 0806e23
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
3 changes: 0 additions & 3 deletions stdlib/core.vxl
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,6 @@ function getProperty(thing, property) {
syscall Lu({key: key, value: thing[key]}, pairs);
}

syscall io_out(pairs);
syscall io_out("\n");

return pairs;
}

Expand Down
1 change: 0 additions & 1 deletion test/objects/expected.log
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Get object keys: key,nestedObject,list,quoted key value,newKey
Get object values: 321,{"key1":"value1","key2":"value2","anotherNestedObject":{"key":"value"}},a,b,c,true,789
321,{"key1":"value1","key2":"value2","anotherNestedObject":{"key":"value"}},a,b,c,true,789
Get object pairs: {"key":"key","value":321},{"key":"nestedObject","value":{"key1":"value1","key2":"value2","anotherNestedObject":{"key":"value"}}},{"key":"list","value":["a","b","c"]},{"key":"quoted key value","value":true},{"key":"newKey","value":789}
{"key":"key","value":321},{"key":"nestedObject","value":{"key1":"value1","key2":"value2","anotherNestedObject":{"key":"value"}}},{"key":"list","value":["a","b","c"]},{"key":"quoted key value","value":true},{"key":"newKey","value":789}
Removing nested object: {"key":321,"list":["a","b","c"],"quoted key value":true,"newKey":789}
Get value using property accessor on mangled object: key = 123
Set value using property accessor on mangled object: key = 456
Expand Down
2 changes: 2 additions & 0 deletions test/prototypes/expected.log
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ key2: secondaryParent value2
key3: primaryParent value3
key4: secondaryParent value4
key5: child value5
values: child value1,child value5,secondaryParent value2,secondaryParent value4,primaryParent value3
child value1,child value5,secondaryParent value2,secondaryParent value4,primaryParent value3
Set keys
key2: child value2
key4: child value4
Expand Down
4 changes: 4 additions & 0 deletions test/prototypes/main.vxl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ syscall io_out("key5: ");
syscall io_out(child.key5);
syscall io_out("\n");

syscall io_out("values: ");
syscall io_out(child.values);
syscall io_out("\n");

child.key2 = "child value2";
child.key4 = "child value4";

Expand Down

0 comments on commit 0806e23

Please sign in to comment.