Javascript type conversion support
Add testcase for previous commit. Add missing assert for future type conversions support that will use the heap instead of pointer casts (for smart pointer type conversions). Closes #1963
This commit is contained in:
parent
fee5e239ec
commit
04b46cc8a3
4 changed files with 19 additions and 0 deletions
14
Examples/test-suite/javascript/types_directive_runme.js
Normal file
14
Examples/test-suite/javascript/types_directive_runme.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
var types_directive = require("types_directive");
|
||||
|
||||
d1 = new types_directive.Time1(2001, 2, 3, 60)
|
||||
// check that a Time1 instance is accepted where Date is expected
|
||||
newDate = types_directive.add(d1, 7)
|
||||
if (newDate.day != 10)
|
||||
throw new Error("newDate mismatch")
|
||||
|
||||
d2 = new types_directive.Time2(1999, 8, 7, 60)
|
||||
// check that a Time2 instance is accepted where Date is expected
|
||||
newDate = types_directive.add(d2, 7)
|
||||
if (newDate.day != 14)
|
||||
throw new Error("newDate mismatch")
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue