|
1 | 1 | --TEST |
2 | | -Test V8::executeString() : Check if imported code works with some unicode symbols |
| 2 | +Test V8::executeString() : Check if imported code works with umlauts |
3 | 3 | --SKIPIF-- |
| 4 | +<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> |
| 5 | +--FILE-- |
4 | 6 | <?php |
5 | | -# check if v8js was compiled with snapshot support |
6 | | -define('V8_WITH_SNAPSHOT', method_exists("V8Js", "createSnapshot")); |
7 | 7 |
|
8 | 8 | # maybe more characters (e.g. from http://www.ltg.ed.ac.uk/~richard/unicode-sample.html?) |
9 | 9 | $unicode = 'äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█ ㌀ ㌁ ㌂ ㌃'; |
10 | 10 |
|
11 | 11 | # insert unicode via snapshot |
12 | | -if (V8_WITH_SNAPSHOT) { |
13 | | - $snapshot = V8Js::createSnapshot("var snapshot = {unicode: '" . $unicode . "'}"); |
14 | | -} else { |
15 | | - # argument is only checked for type and further ignored |
16 | | - $snapshot = ''; |
17 | | -} |
| 12 | +$snapshot = V8Js::createSnapshot("var snapshot = {unicode: '" . $unicode . "'}"); |
18 | 13 |
|
19 | 14 | # start V8Js |
20 | 15 | $jscript = new V8Js('php', array(), array(), true, $snapshot); |
|
27 | 22 |
|
28 | 23 | # return to php |
29 | 24 | $jscript->executeString("values = {}"); |
30 | | -if (V8_WITH_SNAPSHOT) { |
31 | | - $jscript->executeString("values['snapshot'] = snapshot.unicode"); |
32 | | -} else { |
33 | | - # shim this test |
34 | | - $jscript->executeString("values['snapshot'] = '" . $unicode . "'"); |
35 | | -} |
| 25 | +$jscript->executeString("values['snapshot'] = snapshot.unicode"); |
36 | 26 | $jscript->executeString("values['php'] = php.unicode"); |
37 | 27 | $jscript->executeString("values['execStr'] = execStr.unicode"); |
38 | 28 | $values = $jscript->executeString("values"); |
|
41 | 31 | echo "php : $values->php\n"; |
42 | 32 | echo "execStr : $values->execStr\n"; |
43 | 33 | ?> |
44 | | -===EOF=== |
45 | | ---EXPECT-- |
| 34 | +===EOF |
| 35 | +--EXPECTF-- |
46 | 36 | snapshot: äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█ ㌀ ㌁ ㌂ ㌃ |
47 | 37 | php : äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█ ㌀ ㌁ ㌂ ㌃ |
48 | 38 | execStr : äöüßÜÄÖÜ߀áàâÁÀµ²³▁▂▃▄▅▆▇█ ㌀ ㌁ ㌂ ㌃ |
|
0 commit comments