@@ -583,14 +583,24 @@ def testOperationPrint():
583583 r"""
584584 func.func @f1(%arg0: i32) -> i32 {
585585 %0 = arith.constant dense<[1, 2, 3, 4]> : tensor<4xi32> loc("nom")
586+ %1 = arith.constant dense_resource<resource1> : tensor<3xi64>
586587 return %arg0 : i32
587588 }
589+
590+ {-#
591+ dialect_resources: {
592+ builtin: {
593+ resource1: "0x08000000010000000000000002000000000000000300000000000000"
594+ }
595+ }
596+ #-}
588597 """ ,
589598 ctx ,
590599 )
591600
592601 # Test print to stdout.
593602 # CHECK: return %arg0 : i32
603+ # CHECK: resource1: "0x08
594604 module .operation .print ()
595605
596606 # Test print to text file.
@@ -607,7 +617,8 @@ def testOperationPrint():
607617 module .operation .write_bytecode (bytecode_stream , desired_version = 1 )
608618 bytecode = bytecode_stream .getvalue ()
609619 assert bytecode .startswith (b"ML\xef R" ), "Expected bytecode to start with MLïR"
610- module_roundtrip = Module .parse (bytecode , ctx )
620+ ctx2 = Context ()
621+ module_roundtrip = Module .parse (bytecode , ctx2 )
611622 f = io .StringIO ()
612623 module_roundtrip .operation .print (file = f )
613624 roundtrip_value = f .getvalue ()
@@ -633,7 +644,8 @@ def testOperationPrint():
633644
634645 # Test print with options.
635646 # CHECK: value = dense_resource<__elided__> : tensor<4xi32>
636- # CHECK: "func.return"(%arg0) : (i32) -> () -:4:7
647+ # CHECK: "func.return"(%arg0) : (i32) -> () -:5:7
648+ # CHECK-NOT: resource1: "0x08
637649 module .operation .print (
638650 large_elements_limit = 2 ,
639651 enable_debug_info = True ,
0 commit comments