Skip to content
This repository was archived by the owner on Apr 1, 2024. It is now read-only.

Commit 8178618

Browse files
committed
add FIXMEs required by HHVM 4.20+
1 parent f629af6 commit 8178618

File tree

3 files changed

+40
-18
lines changed

3 files changed

+40
-18
lines changed

tests/AttributesCoercionModeTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function testIntishStringAsInt(): void {
6161
expect(() ==> {
6262
XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::THROW_EXCEPTION);
6363
/* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */
64+
/* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */
6465
$x = <test:attribute-coercion-modes myint="1" />;
6566
})->toThrow(XHPInvalidAttributeException::class);
6667
}
@@ -69,6 +70,7 @@ public function testFloatAsInt(): void {
6970
expect(() ==> {
7071
XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::THROW_EXCEPTION);
7172
/* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */
73+
/* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */
7274
$x = <test:attribute-coercion-modes myint={1.23} />;
7375
})->toThrow(XHPInvalidAttributeException::class);
7476
}
@@ -77,6 +79,7 @@ public function testIntAsFloat(): void {
7779
expect(() ==> {
7880
XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::THROW_EXCEPTION);
7981
/* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */
82+
/* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */
8083
$x = <test:attribute-coercion-modes myfloat={2} />;
8184
})->toThrow(XHPInvalidAttributeException::class);
8285
}
@@ -85,6 +88,7 @@ public function testIntAsString(): void {
8588
expect(() ==> {
8689
XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::THROW_EXCEPTION);
8790
/* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */
91+
/* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */
8892
$x = <test:attribute-coercion-modes mystring={2} />;
8993
})->toThrow(XHPInvalidAttributeException::class);
9094
}
@@ -93,6 +97,7 @@ public function testIntAsBool(): void {
9397
expect(() ==> {
9498
XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::THROW_EXCEPTION);
9599
/* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */
100+
/* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */
96101
$x = <test:attribute-coercion-modes mybool={1} />;
97102
})->toThrow(XHPInvalidAttributeException::class);
98103
}
@@ -101,6 +106,7 @@ public function testStringAsBool(): void {
101106
expect(() ==> {
102107
XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::THROW_EXCEPTION);
103108
/* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */
109+
/* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */
104110
$x = <test:attribute-coercion-modes mybool="true" />;
105111
})->toThrow(XHPInvalidAttributeException::class);
106112
}
@@ -109,6 +115,7 @@ public function testSilentCoercion(): void {
109115
error_reporting(E_ALL);
110116
XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::SILENT);
111117
/* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */
118+
/* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */
112119
$x = <test:attribute-coercion-modes mystring={2} />;
113120
expect($x->:mystring)->toBeSame('2');
114121
}
@@ -120,6 +127,7 @@ public function testLoggingDeprecationCoercion(): void {
120127
XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::LOG_DEPRECATION);
121128
try {
122129
/* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */
130+
/* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */
123131
$x = <test:attribute-coercion-modes mystring={2} />;
124132
} catch (Exception $e) {
125133
$exception = $e;
@@ -128,6 +136,7 @@ public function testLoggingDeprecationCoercion(): void {
128136

129137
error_reporting(E_ALL & ~E_USER_DEPRECATED);
130138
/* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */
139+
/* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */
131140
$x = <test:attribute-coercion-modes mystring={2} />;
132141
expect($x->:mystring)->toBeSame('2');
133142
}

tests/AttributesTest.php

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public function testShapeWithExtraKey(): void {
9898
$x =
9999
<test:attribute-types
100100
/* HH_IGNORE_ERROR[4110] */
101+
/* HH_IGNORE_ERROR[4343] */
101102
/* HH_IGNORE_ERROR[4166] */
102103
myshape={shape('foo' => 'herp', 'bar' => 'derp', 'baz' => 'extra')}
103104
/>;
@@ -130,7 +131,7 @@ public function testValidArrayKeys(): void {
130131

131132
public function testInvalidArrayKeys(): void {
132133
expect(() ==> {
133-
$x = <test:attribute-types myarraykey={/* HH_FIXME[4110] */ 1.23} />;
134+
$x = <test:attribute-types myarraykey={/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ 1.23} />;
134135
$x->toString();
135136
})->toThrow(XHPInvalidAttributeException::class);
136137
}
@@ -144,7 +145,7 @@ public function testValidNum(): void {
144145

145146
public function testInvalidNum(): void {
146147
expect(() ==> {
147-
$x = <test:attribute-types mynum=/* HH_FIXME[4110] */ "123" />;
148+
$x = <test:attribute-types mynum=/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ "123" />;
148149
$x->toString();
149150
})->toThrow(XHPInvalidAttributeException::class);
150151
}
@@ -155,12 +156,14 @@ public function testNoAttributes(): void {
155156

156157
public function testStringableObjectAsString(): void {
157158
/* HH_IGNORE_ERROR[4110] */
159+
/* HH_IGNORE_ERROR[4343] */
158160
$x = <test:attribute-types mystring={new StringableTestClass()} />;
159161
expect($x->:mystring)->toBeSame('StringableTestClass');
160162
}
161163

162164
public function testIntegerAsString(): void {
163165
/* HH_IGNORE_ERROR[4110] */
166+
/* HH_IGNORE_ERROR[4343] */
164167
$x = <test:attribute-types mystring={123} />;
165168
expect($x->:mystring)->toBeSame('123');
166169
}
@@ -169,31 +172,34 @@ public function testUnstringableObjectAsString(): void {
169172
expect(() ==> {
170173
$x =
171174
<test:attribute-types
172-
mystring={/* HH_FIXME[4110] */ new EmptyTestClass()}
175+
mystring={/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ new EmptyTestClass()}
173176
/>;
174177
})->toThrow(XHPInvalidAttributeException::class);
175178
}
176179

177180
public function testArrayAsString(): void {
178181
expect(() ==> {
179-
$x = <test:attribute-types mystring={/* HH_FIXME[4110] */ []} />;
182+
$x = <test:attribute-types mystring={/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ []} />;
180183
})->toThrow(XHPInvalidAttributeException::class);
181184
}
182185

183186
public function testIntishStringAsInt(): void {
184187
/* HH_IGNORE_ERROR[4110] */
188+
/* HH_IGNORE_ERROR[4343] */
185189
$x = <test:attribute-types myint={'123'} />;
186190
expect($x->:myint)->toBeSame(123);
187191
}
188192

189193
public function testFloatAsInt(): void {
190194
/* HH_IGNORE_ERROR[4110] */
195+
/* HH_IGNORE_ERROR[4343] */
191196
$x = <test:attribute-types myint={1.23} />;
192197
expect($x->:myint)->toBeSame(1);
193198
}
194199

195200
public function testFloatishStringAsInt(): void {
196201
/* HH_IGNORE_ERROR[4110] */
202+
/* HH_IGNORE_ERROR[4343] */
197203
$x = <test:attribute-types myint="1.23" />;
198204
expect($x->:myint)->toBeSame(1);
199205
}
@@ -202,52 +208,55 @@ public function testObjectAsInt(): void {
202208
expect(() ==> {
203209
$x =
204210
<test:attribute-types
205-
myint={/* HH_FIXME[4110] */ new EmptyTestClass()}
211+
myint={/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ new EmptyTestClass()}
206212
/>;
207213
})->toThrow(XHPInvalidAttributeException::class);
208214
}
209215

210216
public function testArrayAsInt(): void {
211217
expect(() ==> {
212-
$x = <test:attribute-types myint={/* HH_FIXME[4110] */ []} />;
218+
$x = <test:attribute-types myint={/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ []} />;
213219
})->toThrow(XHPInvalidAttributeException::class);
214220
}
215221

216222
public function testNumericPrefixStringAsInt(): void {
217223
expect(() ==> {
218-
$x = <test:attribute-types myint=/* HH_FIXME[4110] */ "123derp" />;
224+
$x = <test:attribute-types myint=/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ "123derp" />;
219225
})->toThrow(XHPInvalidAttributeException::class);
220226
}
221227

222228
public function testTrueStringAsBool(): void {
223229
/* HH_IGNORE_ERROR[4110] */
230+
/* HH_IGNORE_ERROR[4343] */
224231
$x = <test:attribute-types mybool="true" />;
225232
expect($x->:mybool)->toBeSame(true);
226233
}
227234

228235
public function testFalseStringAsBool(): void {
229236
/* HH_IGNORE_ERROR[4110] */
237+
/* HH_IGNORE_ERROR[4343] */
230238
$x = <test:attribute-types mybool="false" />;
231239
expect($x->:mybool)->toBeSame(false);
232240
}
233241

234242
public function testMixedCaseFalseStringAsBool(): void {
235243
expect(() ==> {
236-
$x = <test:attribute-types mybool=/* HH_FIXME[4110] */ "False" />;
244+
$x = <test:attribute-types mybool=/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ "False" />;
237245
})->toThrow(XHPInvalidAttributeException::class);
238246
// 'False' is actually truthy
239247
}
240248

241249
public function testNoStringAsBool(): void {
242250
expect(() ==> {
243-
$x = <test:attribute-types mybool=/* HH_FIXME[4110] */ "No" />;
251+
$x = <test:attribute-types mybool=/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ "No" />;
244252
})->toThrow(XHPInvalidAttributeException::class);
245253
// 'No' is actually truthy
246254
}
247255

248256
public function testAttrNameAsBool(): void {
249257
// idiomatic - eg checked="checked"
250258
/* HH_IGNORE_ERROR[4110] */
259+
/* HH_IGNORE_ERROR[4343] */
251260
$x = <test:attribute-types mybool="mybool" />;
252261
expect($x->:mybool)->toBeSame(true);
253262
}
@@ -260,36 +269,39 @@ public function testInvalidEnumValue(): void {
260269

261270
public function testIntAsFloat(): void {
262271
/* HH_IGNORE_ERROR[4110] */
272+
/* HH_IGNORE_ERROR[4343] */
263273
$x = <test:attribute-types myfloat={123} />;
264274
expect($x->:myfloat)->toBeSame(123.0);
265275
}
266276

267277
public function testNumericStringsAsFloats(): void {
268278
/* HH_IGNORE_ERROR[4110] */
279+
/* HH_IGNORE_ERROR[4343] */
269280
$x = <test:attribute-types myfloat="123" />;
270281
expect($x->:myfloat)->toBeSame(123.0);
271282
/* HH_IGNORE_ERROR[4110] */
283+
/* HH_IGNORE_ERROR[4343] */
272284
$x = <test:attribute-types myfloat="1.23" />;
273285
expect($x->:myfloat)->toBeSame(1.23);
274286
}
275287

276288
public function testNonNumericStringAsFloat(): void {
277289
expect(() ==> {
278-
$x = <test:attribute-types myfloat=/* HH_FIXME[4110] */ "herpderp" />;
290+
$x = <test:attribute-types myfloat=/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ "herpderp" />;
279291
})->toThrow(XHPInvalidAttributeException::class);
280292
}
281293

282294
public function testNumericPrefixStringAsFloat(): void {
283295
expect(() ==> {
284-
$x = <test:attribute-types myfloat=/* HH_FIXME[4110] */ "123derp" />;
296+
$x = <test:attribute-types myfloat=/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ "123derp" />;
285297
})->toThrow(XHPInvalidAttributeException::class);
286298
}
287299

288300
public function testNotAContainerAsArray(): void {
289301
expect(() ==> {
290302
$x =
291303
<test:attribute-types
292-
myarray={/* HH_FIXME[4110] */ new EmptyTestClass()}
304+
myarray={/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ new EmptyTestClass()}
293305
/>;
294306
})->toThrow(XHPInvalidAttributeException::class);
295307
}
@@ -298,7 +310,7 @@ public function testHackContainerAsArray(): void {
298310
expect(() ==> {
299311
$x =
300312
<test:attribute-types
301-
myarray={/* HH_FIXME[4110] */ Vector {1, 2, 3}}
313+
myarray={/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ Vector {1, 2, 3}}
302314
/>;
303315
})->toThrow(XHPInvalidAttributeException::class);
304316
}
@@ -307,14 +319,14 @@ public function testIncompatibleObjectAsObject(): void {
307319
expect(() ==> {
308320
$x =
309321
<test:attribute-types
310-
myobject={/* HH_FIXME[4110] */ new EmptyTestClass()}
322+
myobject={/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ new EmptyTestClass()}
311323
/>;
312324
})->toThrow(XHPInvalidAttributeException::class);
313325
}
314326

315327
public function testPassingArrayAsVector(): void {
316328
expect(() ==> {
317-
$x = <test:attribute-types myvector={/* HH_FIXME[4110] */ [1, 2, 3]} />;
329+
$x = <test:attribute-types myvector={/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ [1, 2, 3]} />;
318330
})->toThrow(XHPInvalidAttributeException::class);
319331
}
320332

@@ -380,6 +392,7 @@ public function testRenderCallableAttribute(): void {
380392
$x =
381393
<test:callable-attribute
382394
/* HH_IGNORE_ERROR[4110] */
395+
/* HH_IGNORE_ERROR[4343] */
383396
foo={function() {
384397
}}
385398
/>;

tests/HackEnumAttributesTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ public function testValidValues(): void {
4141

4242
public function testValidRawValues(): void {
4343
// UNSAFE
44-
$x = <test:hack-enum-attribute foo={/* HH_IGNORE_ERROR[4110] */ 1} />;
44+
$x = <test:hack-enum-attribute foo={/* HH_IGNORE_ERROR[4110] */ /* HH_IGNORE_ERROR[4343] */ 1} />;
4545
expect($x->toString())->toBeSame('<div>HERP</div>');
46-
$x = <test:hack-enum-attribute foo={/* HH_IGNORE_ERROR[4110] */2} />;
46+
$x = <test:hack-enum-attribute foo={/* HH_IGNORE_ERROR[4110] *//* HH_IGNORE_ERROR[4343] */2} />;
4747
expect($x->toString())->toBeSame('<div>DERP</div>');
4848
}
4949

5050
public function testInvalidValue(): void {
5151
expect(() ==> {
52-
$x = <test:hack-enum-attribute foo={/* HH_FIXME[4110] */ 0} />;
52+
$x = <test:hack-enum-attribute foo={/* HH_FIXME[4110] */ /* HH_FIXME[4343] */ 0} />;
5353
})->toThrow(XHPInvalidAttributeException::class);
5454
}
5555
}

0 commit comments

Comments
 (0)