From 209b9cb81d211a1febf231609c5a5cab941d5437 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Thu, 5 Feb 2026 19:45:34 +0800 Subject: [PATCH] =?UTF-8?q?test(aot):=20=E6=B7=BB=E5=8A=A0=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E9=93=BE=E6=8E=A5=E6=93=8D=E4=BD=9C=E7=AC=A6=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 创建了 TestAttrRef 类用于测试属性引用功能 - 实现了构造函数中的数组排序和切片操作逻辑 - 添加了主函数用于实例化测试对象并传入参数 - 定义了预期输出验证数组操作结果的正确性 --- tests/aot/attr-ref.phpt | 63 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 tests/aot/attr-ref.phpt diff --git a/tests/aot/attr-ref.phpt b/tests/aot/attr-ref.phpt new file mode 100644 index 00000000..a9b66638 --- /dev/null +++ b/tests/aot/attr-ref.phpt @@ -0,0 +1,63 @@ +--TEST-- +object link operator +--FILE-- +k = $k; + $this->nums = $nums; + rsort($this->nums); + var_dump($this->nums); + $this->nums = [34, 5, 8, 2]; + var_dump($this->nums); + $this->nums = array_slice($this->nums, 0, $k); + var_dump($this->nums); + } +} + +function main() +{ + $k = 3; + $nums = [4, 5, 8, 2]; + $obj = new TestAttrRef($k, $nums); +} +?> +--EXPECT-- +array(4) { + [0]=> + int(8) + [1]=> + int(5) + [2]=> + int(4) + [3]=> + int(2) +} +array(4) { + [0]=> + int(34) + [1]=> + int(5) + [2]=> + int(8) + [3]=> + int(2) +} +array(3) { + [0]=> + int(34) + [1]=> + int(5) + [2]=> + int(8) +}