@@ -12,7 +12,9 @@ class :test:attribute-types extends :x:element {
1212 enum {' foo' , ' bar' } myenum ,
1313 float myfloat ,
1414 Vector < string > myvector ,
15- Map < string , string > mymap ;
15+ Map < string , string > mymap ,
16+ arraykey myarraykey ,
17+ num mynum ;
1618
1719 protected function render (): XHPRoot {
1820 return <div /> ;
@@ -69,6 +71,36 @@ public function testValidTypes(): void {
6971 $this -> assertEquals(' <div></div>' , $x -> toString());
7072 }
7173
74+ public function testValidArrayKeys (): void {
75+ $x = <test:attribute-types myarraykey = " foo" /> ;
76+ $this -> assertSame(' <div></div>' , $x -> toString());
77+ $x = <test:attribute-types myarraykey = { 123 } /> ;
78+ $this -> assertSame(' <div></div>' , $x -> toString());
79+ }
80+
81+ /**
82+ * @expectedException XHPInvalidAttributeException
83+ */
84+ public function testInvalidArrayKeys (): void {
85+ $x = <test:attribute-types myarraykey = { 1.23 } /> ;
86+ $x -> toString();
87+ }
88+
89+ public function testValidNum (): void {
90+ $x = <test:attribute-types mynum = { 123 } /> ;
91+ $this -> assertSame(' <div></div>' , $x -> toString());
92+ $x = <test:attribute-types mynum = { 1.23 } /> ;
93+ $this -> assertSame(' <div></div>' , $x -> toString());
94+ }
95+
96+ /**
97+ * @expectedException XHPInvalidAttributeException
98+ */
99+ public function testInvalidNum (): void {
100+ $x = <test:attribute-types mynum = " 123" /> ;
101+ $x -> toString();
102+ }
103+
72104 public function testNoAttributes (): void {
73105 $this -> assertEquals(' <div></div>' , <test:attribute-types /> );
74106 }
0 commit comments