@@ -371,29 +371,29 @@ def test_mangle_functype(params, results, expect):
371
371
got = mangle_funcname ('x' , ft )
372
372
expect = 'x: ' + expect
373
373
if got != expect :
374
- fail ("test_mangle_func({}) expected {}, got {}" .format (ft , expect , got ))
374
+ fail ("test_mangle_func() got: \n {} \n expected: \n {}" .format (got , expect ))
375
375
376
376
test_mangle_functype ([U8 ()], [U8 ()], 'func u8 -> u8' )
377
377
test_mangle_functype ([U8 ()], [], 'func u8 -> ()' )
378
378
test_mangle_functype ([], [U8 ()], 'func () -> u8' )
379
- test_mangle_functype ([('x' ,U8 ())], [('y' ,U8 ())], 'func (x:u8) -> (y:u8)' )
379
+ test_mangle_functype ([('x' ,U8 ())], [('y' ,U8 ())], 'func (x: u8) -> (y: u8)' )
380
380
test_mangle_functype ([('a' ,Bool ()),('b' ,U8 ()),('c' ,S16 ()),('d' ,U32 ()),('e' ,S64 ())],
381
381
[('a' ,S8 ()),('b' ,U16 ()),('c' ,S32 ()),('d' ,U64 ())],
382
- 'func (a:bool, b:u8, c:s16, d:u32, e:s64) -> (a:s8, b:u16, c:s32, d:u64)' )
382
+ 'func (a: bool, b: u8, c: s16, d: u32, e: s64) -> (a: s8, b: u16, c: s32, d: u64)' )
383
383
test_mangle_functype ([List (List (String ()))], [],
384
384
'func list<list<string>> -> ()' )
385
385
test_mangle_functype ([Record ([Field ('x' ,Record ([Field ('y' ,String ())])),Field ('z' ,U32 ())])], [],
386
- 'func record{x: record{y: string}, z:u32} -> ()' )
386
+ 'func record { x: record { y: string }, z: u32 } -> ()' )
387
387
test_mangle_functype ([Tuple ([U8 ()])], [Tuple ([U8 (),U8 ()])],
388
388
'func tuple<u8> -> tuple<u8, u8>' )
389
389
test_mangle_functype ([Flags (['a' ,'b' ])], [Enum (['a' ,'b' ])],
390
- 'func flags{ a, b} -> enum{ a, b}' )
390
+ 'func flags { a, b } -> enum { a, b }' )
391
391
test_mangle_functype ([Variant ([Case ('a' ,None ),Case ('b' ,U8 ())])], [Union ([U8 (),List (String ())])],
392
- 'func variant{ a(_), b(u8)} -> union{ u8, list<string>}' )
392
+ 'func variant { a(_), b(u8) } -> union { u8, list<string> }' )
393
393
test_mangle_functype ([Option (Bool ())],[Option (List (U8 ()))],
394
394
'func option<bool> -> option<list<u8>>' )
395
395
test_mangle_functype ([], [('a' ,Result (None ,None )),('b' ,Result (U8 (),None )),('c' ,Result (None ,U8 ()))],
396
- 'func () -> (a:result<_, _>, b:result<u8, _>, c:result<_, u8>)' )
396
+ 'func () -> (a: result<_, _>, b: result<u8, _>, c: result<_, u8>)' )
397
397
398
398
def test_cabi (ct , expect ):
399
399
got = canonical_module_type (ct )
@@ -411,7 +411,7 @@ def test_cabi(ct, expect):
411
411
[CoreImportDecl ('' ,'a: func u8 -> u8' , CoreFuncType (['i32' ],['i32' ]))],
412
412
[CoreExportDecl ('cabi_memory' , CoreMemoryType (0 , None )),
413
413
CoreExportDecl ('cabi_realloc' , CoreFuncType (['i32' ,'i32' ,'i32' ,'i32' ],['i32' ])),
414
- CoreExportDecl ('cabi_start{cabi=0.1}: func (b:string) -> (d:list<u8>)' ,
414
+ CoreExportDecl ('cabi_start{cabi=0.1}: func (b: string) -> (d: list<u8>)' ,
415
415
CoreFuncType (['i32' ,'i32' ],['i32' ])),
416
416
CoreExportDecl ('c: func s8 -> s8' , CoreFuncType (['i32' ],['i32' ]))]
417
417
)
@@ -431,7 +431,7 @@ def test_cabi(ct, expect):
431
431
[CoreImportDecl ('' ,'a.b: func u8 -> u8' , CoreFuncType (['i32' ],['i32' ]))],
432
432
[CoreExportDecl ('cabi_memory' , CoreMemoryType (0 , None )),
433
433
CoreExportDecl ('cabi_realloc' , CoreFuncType (['i32' ,'i32' ,'i32' ,'i32' ],['i32' ])),
434
- CoreExportDecl ('cabi_start{cabi=0.1}: func (a.c:float32) -> (d.f:float64)' ,
434
+ CoreExportDecl ('cabi_start{cabi=0.1}: func (a.c: float32) -> (d.f: float64)' ,
435
435
CoreFuncType (['f32' ],['f64' ])),
436
436
CoreExportDecl ('d.e: func () -> list<string>' , CoreFuncType ([],['i32' ])),
437
437
CoreExportDecl ('cabi_post_d.e' , CoreFuncType (['i32' ],[]))]
@@ -449,10 +449,10 @@ def test_cabi(ct, expect):
449
449
),
450
450
ModuleType (
451
451
[CoreImportDecl ('' ,'foo: func () -> ()' , CoreFuncType ([],[])),
452
- CoreImportDecl ('' ,'a.bar: func (x:u32, y:u32) -> u32' , CoreFuncType (['i32' ,'i32' ],['i32' ]))],
452
+ CoreImportDecl ('' ,'a.bar: func (x: u32, y: u32) -> u32' , CoreFuncType (['i32' ,'i32' ],['i32' ]))],
453
453
[CoreExportDecl ('cabi_memory' , CoreMemoryType (0 , None )),
454
454
CoreExportDecl ('cabi_realloc' , CoreFuncType (['i32' ,'i32' ,'i32' ,'i32' ],['i32' ])),
455
- CoreExportDecl ('cabi_start{cabi=0.1}: func (v1:string) -> (v2:list<list<string>>)' ,
455
+ CoreExportDecl ('cabi_start{cabi=0.1}: func (v1: string) -> (v2: list<list<string>>)' ,
456
456
CoreFuncType (['i32' ,'i32' ],['i32' ])),
457
457
CoreExportDecl ('baz: func () -> string' , CoreFuncType ([],['i32' ])),
458
458
CoreExportDecl ('cabi_post_baz' , CoreFuncType (['i32' ],[]))]
0 commit comments