From 09f69caf64201ae5f95e5cc2650c21e171027203 Mon Sep 17 00:00:00 2001 From: Stefan Siegl Date: Fri, 14 Apr 2017 22:48:39 +0200 Subject: [PATCH] Relax test to work on V8 without i18n support --- tests/issue_306_basic.phpt | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/issue_306_basic.phpt b/tests/issue_306_basic.phpt index c3d0244..8b6f8e7 100644 --- a/tests/issue_306_basic.phpt +++ b/tests/issue_306_basic.phpt @@ -7,12 +7,22 @@ Test V8::executeString() : Issue #306 V8 crashing on toLocaleString() $v8 = new V8Js(); -$v8 = new V8Js; $expr = 'new Date("10/11/2009").toLocaleString("en-us", { month: "long" });'; -var_dump( $v8->executeString($expr, null, V8Js::FLAG_FORCE_ARRAY) ); +$result = $v8->executeString($expr); + +// V8 can be compiled with i18n support and without; +// without i18n support however toLocaleString doesn't really work, +// it just returns the date string... + +if ($result === 'October') { + var_dump(true); +} else { + $expr = 'new Date("10/11/2009").toString();'; + var_dump($v8->executeString($expr) === $result); +} ?> ===EOF=== --EXPECT-- -string(7) "October" -===EOF=== +bool(true) +===EOF=== \ No newline at end of file