@@ -165,6 +165,28 @@ public static function provideTestUnnaturalLiterals() {
165165 ];
166166 }
167167
168+ /** @dataProvider provideTestCustomRawValue */
169+ public function printCustomRawValue ($ node , $ expected ): void {
170+ $ prettyPrinter = new PrettyPrinter \Standard ();
171+ $ result = $ prettyPrinter ->prettyPrintExpr ($ node );
172+ $ this ->assertSame ($ expected , $ result );
173+ }
174+
175+ public static function provideTestCustomRawValue () {
176+ return [
177+ // Decimal with separator
178+ [new Int_ (1000 , ['rawValue ' => '10_00 ' , 'shouldPrintRawValue ' => true ]), '10_00 ' ],
179+ // Hexadecimal with separator
180+ [new Int_ (0xDEADBEEF , ['kind ' => Int_::KIND_HEX , 'rawValue ' => '0xDEAD_BEEF ' , 'shouldPrintRawValue ' => true ]), '0xDEAD_BEEF ' ],
181+ // Binary with separator
182+ [new Int_ (0b11110000 , ['kind ' => Int_::KIND_BIN , 'rawValue ' => '0b1111_0000 ' , 'shouldPrintRawValue ' => true ]), '0b1111_0000 ' ],
183+ // Octal with separator
184+ [new Int_ (0755 , ['kind ' => Int_::KIND_OCT , 'rawValue ' => '0755_000 ' , 'shouldPrintRawValue ' => true ]), '0755_000 ' ],
185+ // Without flag set, should use default formatting
186+ [new Int_ (1000 , ['rawValue ' => '10_00 ' , 'shouldPrintRawValue ' => false ]), '1000 ' ],
187+ ];
188+ }
189+
168190 public function testPrettyPrintWithError (): void {
169191 $ this ->expectException (\LogicException::class);
170192 $ this ->expectExceptionMessage ('Cannot pretty-print AST with Error nodes ' );
0 commit comments