blockchainmove-langsui

Is there a more elegant way to print some text then debug::print(&utf8(b"some text printed out")); in Sui move?


I'm using the debug module from the std move package in a test function.

    use std::debug;

    /* std and sui modules debug tests */
    #[test]
    fun test_module(){
        debug::print(&utf8(b"some text printed out"));
    }

What other options do I have to print a text output to the console? What is the most elegant way to do this?


Solution

  • Inside a test, you can do test_utils::print(b"some text printed out")

    use sui::test_utils::{Self};
    
    /* std and sui modules debug tests */
    #[test]
    fun test_module(){
       test_utils::print(b"some text printed out")
    }
    

    The test_utils module can be found here.