@@ -54,12 +54,19 @@ info('All primitive types %s %s %s %s %s %s %s', 'string', 123, true, BigInt(123
5454declare const errorOrString : string | Error ;
5555info ( errorOrString )
5656
57+ // %o placeholder supports primitives too (except undefined)
58+ info ( 'Boolean %o' , true ) ;
59+ info ( 'Boolean %o' , false ) ;
60+ info ( 'Number %o' , 123 ) ;
61+ info ( 'Number %o' , 3.14 ) ;
62+ info ( 'BigInt %o' , BigInt ( 123 ) ) ;
63+ info ( 'Null %o' , null ) ;
64+ info ( 'Symbol %o' , Symbol ( 'test' ) ) ;
65+ info ( 'String %o' , 'hello' ) ;
66+
5767// placeholder messages type errors
5868expectError ( info ( 'The answer is %d' , 'not a number' ) ) ;
59- expectError ( info ( 'The object is %o' , 'not an object' ) ) ;
60- expectError ( info ( 'The object is %j' , 'not a JSON' ) ) ;
61- expectError ( info ( 'The object is %O' , 'not an object' ) ) ;
62- expectError ( info ( 'The answer is %d and the question is %s with %o' , 42 , { incorrect : 'order' } , 'unknown' ) ) ;
69+ expectError ( info ( 'The answer is %d and the question is %s with %o' , 'unknown' , { incorrect : 'order' } , 42 ) ) ;
6370expectError ( info ( 'Extra message %s' , 'after placeholder' , 'not allowed' ) ) ;
6471
6572// object types with messages
0 commit comments