From 33725b87d349f2a71a8ddb26ddf7ff0a141e8d94 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Fri, 22 May 2026 20:54:53 +0800 Subject: [PATCH] =?UTF-8?q?test(aot):=20=E6=B7=BB=E5=8A=A0=E9=AD=94?= =?UTF-8?q?=E6=9C=AF=E5=B8=B8=E9=87=8F=E3=80=81=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=E6=8F=92=E5=80=BC=E5=92=8C=E5=8F=98=E9=87=8F=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E7=9A=84AOT=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加magic-constants.phpt测试文件验证__LINE__、__FILE__、__DIR__、__FUNCTION__、__METHOD__、__CLASS__常量 - 添加string-interpolation.phpt测试文件验证复杂表达式的字符串插值功能 - 添加variable-functions.phpt测试文件验证可变函数调用和回调存储功能 - 添加variable-variables.phpt测试文件验证$$var语法并标记为跳过(AOT不支持) --- tests/aot/magic-constants.phpt | 37 ++++++++++++++++++++++++++ tests/aot/string-interpolation.phpt | 38 ++++++++++++++++++++++++++ tests/aot/variable-functions.phpt | 41 +++++++++++++++++++++++++++++ tests/aot/variable-variables.phpt | 16 +++++++++++ 4 files changed, 132 insertions(+) create mode 100644 tests/aot/magic-constants.phpt create mode 100644 tests/aot/string-interpolation.phpt create mode 100644 tests/aot/variable-functions.phpt create mode 100644 tests/aot/variable-variables.phpt diff --git a/tests/aot/magic-constants.phpt b/tests/aot/magic-constants.phpt new file mode 100644 index 00000000..4eb02b1c --- /dev/null +++ b/tests/aot/magic-constants.phpt @@ -0,0 +1,37 @@ +--TEST-- +Magic constants: __LINE__, __FILE__, __DIR__, __FUNCTION__, __METHOD__, __CLASS__ +--FILE-- +testMethod(); +} + +?> +--EXPECTF-- +__LINE__: int(%d) +__FILE__: string(%d) "magic-constants.php" +__DIR__: string(%d) "aot" +__FUNCTION__ in function: string(%d) "testFunction" +__METHOD__: string(%d) "TestMagicConst::testMethod" +__CLASS__: string(%d) "TestMagicConst" +__FUNCTION__: string(%d) "testMethod" diff --git a/tests/aot/string-interpolation.phpt b/tests/aot/string-interpolation.phpt new file mode 100644 index 00000000..280efc76 --- /dev/null +++ b/tests/aot/string-interpolation.phpt @@ -0,0 +1,38 @@ +--TEST-- +String interpolation with complex expressions +--FILE-- +name = $name; + } +} + +function main() { + $count = 5; + $arr = [1, 2, 3]; + + // Simple variable interpolation + $s1 = "count is $count"; + var_dump($s1); + + // Array access interpolation + $s2 = "first: {$arr[0]}, last: {$arr[2]}"; + var_dump($s2); + + // Property access interpolation + $person = new Person("Alice"); + $s3 = "Name: {$person->name}"; + var_dump($s3); + + echo "done\n"; +} + +?> +--EXPECT-- +string(10) "count is 5" +string(17) "first: 1, last: 3" +string(11) "Name: Alice" +done diff --git a/tests/aot/variable-functions.phpt b/tests/aot/variable-functions.phpt new file mode 100644 index 00000000..a786e9c1 --- /dev/null +++ b/tests/aot/variable-functions.phpt @@ -0,0 +1,41 @@ +--TEST-- +Variable functions +--FILE-- + +--EXPECT-- +string(12) "Hello, World" +int(10) +int(4) +int(30) +done diff --git a/tests/aot/variable-variables.phpt b/tests/aot/variable-variables.phpt new file mode 100644 index 00000000..8ae99819 --- /dev/null +++ b/tests/aot/variable-variables.phpt @@ -0,0 +1,16 @@ +--TEST-- +Variable variables ($$var) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(5) "world"