From bbb43664fcac3c10cb1b13a007aca67cf9e0821a Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Wed, 3 Jun 2026 18:19:01 +0800 Subject: [PATCH] =?UTF-8?q?test(aot):=20=E6=B7=BB=E5=8A=A0trait=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B=E5=92=8Cdecimal=E7=B1=BB=E5=9E=8Bto?= =?UTF-8?q?String=E6=96=B9=E6=B3=95=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增单个trait简单方法测试用例,验证const数组和方法调用功能 - 添加decimal类型toString方法测试用例,验证浮点数转字符串功能 - 更新版本号从1057到1058 --- tests/aot/decimal/toString.phpt | 14 ++++++++++ tests/aot/trait/012.phpt | 49 +++++++++++++++++++++++++++++++++ version.txt | 2 +- 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 tests/aot/decimal/toString.phpt create mode 100644 tests/aot/trait/012.phpt diff --git a/tests/aot/decimal/toString.phpt b/tests/aot/decimal/toString.phpt new file mode 100644 index 00000000..214a988e --- /dev/null +++ b/tests/aot/decimal/toString.phpt @@ -0,0 +1,14 @@ +--TEST-- +decimal: literal +--FILE-- +toString()); +} +?> +--EXPECT-- +string(3) "0.3" \ No newline at end of file diff --git a/tests/aot/trait/012.phpt b/tests/aot/trait/012.phpt new file mode 100644 index 00000000..ed47835c --- /dev/null +++ b/tests/aot/trait/012.phpt @@ -0,0 +1,49 @@ +--TEST-- +Single Trait with simple trait method +--FILE-- + ['toInt' => 123,], + 'test_fn_2' => ['toInt' => 234, ], + 'test_fn_3' => ['toInt' => 333,], + ]; + + public function run(string $key1) { + var_dump(isset(self::CONST_ARRAY[$key1]['toInt'])); + var_dump(self::CONST_ARRAY[$key1]); + } +} + +class TraitsTest { + use THello; + + function hello1() { + $this->run('test_fn_2'); + } +} + +class Test extends TraitsTest { + function hello2() { + $this->run('test_fn_2'); + } +} + +function main() { + $o1 = new TraitsTest(); + $o1->hello1(); + $o2 = new Test(); + $o2->hello2(); +} +?> +--EXPECT-- +bool(true) +array(1) { + ["toInt"]=> + int(234) +} +bool(true) +array(1) { + ["toInt"]=> + int(234) +} \ No newline at end of file diff --git a/version.txt b/version.txt index c500a5fe..9a9755e4 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1057 +1058