Skip to content

Commit

Permalink
pick up int64 export test from issue phpv8#287
Browse files Browse the repository at this point in the history
  • Loading branch information
stesie committed Mar 8, 2017
1 parent e86c957 commit b45bef4
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/long_int64.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--TEST--
Test V8::executeString() : Check long 64-bit export from PHP to JS
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php

$addInt = function ($a, $b) {
return $a + $b;
};

$v8 = new V8Js('PHP');
$v8->add = $addInt;
$v8->p1 = 10;
$v8->p2 = pow(2,45);

var_dump($v8->p2);

var_dump($v8->executeString('
var res = PHP.p1 + PHP.p2;
"p1:" + PHP.p1 +
", p2:" + PHP.p2 +
", PHP.add(p1,p2)=" + PHP.add(PHP.p1, PHP.p2) +
", p1+p2=" + res +
" -> " + (new Date(res)).toISOString();
'));
?>
===EOF===
--EXPECT--
int(35184372088832)
string(105) "p1:10, p2:35184372088832, PHP.add(p1,p2)=35184372088842, p1+p2=35184372088842 -> 3084-12-12T12:41:28.842Z"
===EOF===

0 comments on commit b45bef4

Please sign in to comment.