Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 409a628

Browse files
committed
[[ Bug 20931 ]] Add tests for array and list assign op bridging
1 parent 2e50bc2 commit 409a628

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

tests/lcb/vm/assign-ops.lcb

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
module __VMTEST.assign_ops
2+
3+
use com.livecode.foreign
4+
5+
foreign handler MCValueGetTypeInfo(in pValue as Pointer) returns Pointer binds to "<builtin>"
6+
7+
foreign handler MCTypeInfoIsForeign(in pTypeInfo as Pointer) returns CBool binds to "<builtin>"
8+
9+
foreign handler MCArrayFetchValue(in pArray as Array, in pCaseSensitive as CBool, in pKey as Pointer, out rValue as Pointer) returns CBool binds to "<builtin>"
10+
11+
foreign handler MCNameCreate(in pString as String, out rName as Pointer) returns CBool binds to "<builtin>"
12+
13+
foreign handler MCProperListFetchElementAtIndex(in pList as List, in pIndex as LCUIndex) returns Pointer binds to "<builtin>"
14+
15+
unsafe handler __IsForeignValue(in pValue as Pointer) returns Boolean
16+
return MCTypeInfoIsForeign(MCValueGetTypeInfo(pValue))
17+
end handler
18+
19+
public handler TestAssignArrayOpForeignBridge()
20+
unsafe
21+
variable tVar as CBool
22+
put false into tVar
23+
24+
variable tKey as Pointer
25+
MCNameCreate("key", tKey)
26+
27+
variable tValue as Pointer
28+
MCArrayFetchValue({"key": tVar}, false, tKey, tValue)
29+
30+
test "foreign value bridged to optional any in array assign" \
31+
when not __IsForeignValue(tValue)
32+
end unsafe
33+
end handler
34+
35+
public handler TestAssignListOpForeignBridge()
36+
unsafe
37+
variable tVar as CBool
38+
put false into tVar
39+
40+
variable tValue as Pointer
41+
put MCProperListFetchElementAtIndex([tVar], 1) into tValue
42+
43+
test "foreign value bridged to optional any in list assign" \
44+
when not __IsForeignValue(tValue)
45+
end unsafe
46+
end handler
47+
48+
end module

0 commit comments

Comments
 (0)