@@ -202,13 +202,13 @@ public void testInlineEvaluation() throws Throwable {
202
202
expectSuspended ((SuspendedEvent event ) -> {
203
203
DebugStackFrame frame = event .getTopStackFrame ();
204
204
assertEquals (5 , frame .getSourceSection ().getStartLine ());
205
- assertEquals ("3" , frame .eval ("a + b" ).as ( String . class ));
205
+ assertEquals ("3" , frame .eval ("a + b" ).toDisplayString ( ));
206
206
event .prepareContinue ();
207
207
});
208
208
expectSuspended ((SuspendedEvent event ) -> {
209
209
DebugStackFrame frame = event .getTopStackFrame ();
210
210
assertEquals (7 , frame .getSourceSection ().getStartLine ());
211
- assertEquals ("6" , frame .eval ("bar() * 2" ).as ( String . class ));
211
+ assertEquals ("6" , frame .eval ("bar() * 2" ).toDisplayString ( ));
212
212
event .prepareContinue ();
213
213
});
214
214
assertEquals ("10" , tester .expectDone ());
@@ -238,8 +238,8 @@ public void testConditionalBreakpointInFunction() throws Throwable {
238
238
expectSuspended ((SuspendedEvent event ) -> {
239
239
DebugStackFrame frame = event .getTopStackFrame ();
240
240
assertEquals (9 , frame .getSourceSection ().getStartLine ());
241
- assertEquals ("10" , frame .eval ("sum" ).as ( String . class ));
242
- assertEquals ("16" , frame .eval ("prod(4)" ).as ( String . class ));
241
+ assertEquals ("10" , frame .eval ("sum" ).toDisplayString ( ));
242
+ assertEquals ("16" , frame .eval ("prod(4)" ).toDisplayString ( ));
243
243
event .prepareContinue ();
244
244
});
245
245
assertEquals ("45" , tester .expectDone ());
@@ -253,7 +253,7 @@ public void testConditionalBreakpointInFunction() throws Throwable {
253
253
expectSuspended ((SuspendedEvent event ) -> {
254
254
DebugStackFrame frame = event .getTopStackFrame ();
255
255
assertEquals (9 , frame .getSourceSection ().getStartLine ());
256
- assertEquals ("4" , frame .eval ("i" ).as ( String . class ));
256
+ assertEquals ("4" , frame .eval ("i" ).toDisplayString ( ));
257
257
event .prepareContinue ();
258
258
});
259
259
assertEquals ("45" , tester .expectDone ());
@@ -276,7 +276,7 @@ public void testConditionalBreakpointGlobal() throws Throwable {
276
276
expectSuspended ((SuspendedEvent event ) -> {
277
277
DebugStackFrame frame = event .getTopStackFrame ();
278
278
assertEquals (3 , frame .getSourceSection ().getStartLine ());
279
- assertEquals ("10" , frame .eval ("sum(values)" ).as ( String . class ));
279
+ assertEquals ("10" , frame .eval ("sum(values)" ).toDisplayString ( ));
280
280
event .prepareContinue ();
281
281
});
282
282
assertEquals ("45" , tester .expectDone ());
@@ -385,22 +385,22 @@ public void testGettersSetters() throws Throwable {
385
385
assertTrue (x .hasWriteSideEffects ());
386
386
assertTrue (x .isReadable ());
387
387
assertTrue (x .isWritable ());
388
- assertEquals (0 , p .getProperty ("__nx" ).as ( Number . class ). intValue ());
389
- assertEquals ("None" , x .as ( String . class ));
390
- assertEquals (1 , p .getProperty ("__nx" ).as ( Number . class ). intValue ());
388
+ assertEquals (0 , p .getProperty ("__nx" ).asInt ());
389
+ assertEquals ("None" , x .toDisplayString ( ));
390
+ assertEquals (1 , p .getProperty ("__nx" ).asInt ());
391
391
x .set (42 );
392
- assertEquals (2 , p .getProperty ("__nx" ).as ( Number . class ). intValue ());
393
- assertEquals ("42" , x .as ( String . class ));
394
- assertEquals (3 , p .getProperty ("__nx" ).as ( Number . class ). intValue ());
392
+ assertEquals (2 , p .getProperty ("__nx" ).asInt ());
393
+ assertEquals ("42" , x .toDisplayString ( ));
394
+ assertEquals (3 , p .getProperty ("__nx" ).asInt ());
395
395
DebugValue y = p .getProperty ("y" );
396
396
assertTrue (y .hasReadSideEffects ());
397
397
assertFalse (y .hasWriteSideEffects ());
398
398
assertTrue (y .isReadable ());
399
399
assertTrue (y .isWritable ());
400
400
DebugValue ny = p .getProperty ("__ny" );
401
- assertEquals (0 , ny .as ( Number . class ). intValue ());
401
+ assertEquals (0 , ny .asInt ());
402
402
y .set (24 );
403
- assertEquals ("24" , y .as ( String . class ));
403
+ assertEquals ("24" , y .toDisplayString ( ));
404
404
});
405
405
}
406
406
}
@@ -427,25 +427,25 @@ public void testInspectJavaArray() throws Throwable {
427
427
// Truffle will now use our language to get a Python view on the primitive object
428
428
// for inspection
429
429
intValue .getMetaObject ();
430
- assertEquals ("0" , intValue .as ( String . class ));
430
+ assertEquals ("0" , intValue .toDisplayString ( ));
431
431
DebugValue longValue = globalScope .getDeclaredValue ("a_long" ).getArray ().get (0 );
432
432
longValue .getMetaObject ();
433
- assertEquals ("0" , longValue .as ( String . class ));
433
+ assertEquals ("0" , longValue .toDisplayString ( ));
434
434
DebugValue shortValue = globalScope .getDeclaredValue ("a_short" ).getArray ().get (0 );
435
435
shortValue .getMetaObject ();
436
- assertEquals ("0" , shortValue .as ( String . class ));
436
+ assertEquals ("0" , shortValue .toDisplayString ( ));
437
437
DebugValue byteValue = globalScope .getDeclaredValue ("a_byte" ).getArray ().get (0 );
438
438
byteValue .getMetaObject ();
439
- assertEquals ("0" , byteValue .as ( String . class ));
439
+ assertEquals ("0" , byteValue .toDisplayString ( ));
440
440
DebugValue floatValue = globalScope .getDeclaredValue ("a_float" ).getArray ().get (0 );
441
441
floatValue .getMetaObject ();
442
- assertEquals ("0.0" , floatValue .as ( String . class ));
442
+ assertEquals ("0.0" , floatValue .toDisplayString ( ));
443
443
DebugValue doubleValue = globalScope .getDeclaredValue ("a_double" ).getArray ().get (0 );
444
444
doubleValue .getMetaObject ();
445
- assertEquals ("0.0" , doubleValue .as ( String . class ));
445
+ assertEquals ("0.0" , doubleValue .toDisplayString ( ));
446
446
DebugValue charValue = globalScope .getDeclaredValue ("a_char" ).getArray ().get (0 );
447
447
charValue .getMetaObject ();
448
- assertEquals ("'\\ x00'" , charValue .as ( String . class ));
448
+ assertEquals ("'\\ x00'" , charValue .toDisplayString ( ));
449
449
});
450
450
}
451
451
}
@@ -525,7 +525,7 @@ private static void checkDebugValues(String msg, Iterable<DebugValue> values, St
525
525
String expectedValue = expectedFrame [i + 1 ];
526
526
DebugValue value = valMap .get (expectedIdentifier );
527
527
assertNotNull (expectedIdentifier + " not found" , value );
528
- assertEquals (expectedValue , value .as ( String . class ));
528
+ assertEquals (expectedValue , value .toDisplayString ( ));
529
529
}
530
530
}
531
531
0 commit comments