Printing the values of variables during forc test

Before anyone says “forc test --logs”, I can confirm I have tried that, after importing std::logging::logs. But the output seems quite unreadable:

failures:
      - test test_sqrt1, "/home/ritik/hello_sway/fraction_sway/src/lib.sw":981 
        revert code: ffffffffffff0004 -- Failing call to `std::assert::assert`
        Logs: [{"Log":{"id":"0000000000000000000000000000000000000000000000000000000000000000","is":10344,"pc":57208,"ra":612372,"rb":0,"rc":0,"rd":0}},{"Log":{"id":"0000000000000000000000000000000000000000000000000000000000000000","is":10344,"pc":57212,"ra":1000000,"rb":1,"rc":0,"rd":0}},{"LogData":{"data":"00000000000145380000000000000002","digest":"4059cebfb1c20b251f416e0413ce90cc76ac3fa477656dcd0979c02292ce49c3","id":"0000000000000000000000000000000000000000000000000000000000000000","is":10344,"len":16,"pc":57264,"ptr":83616,"ra":0,"rb":2}}]

Not sure what someone is expected to make out of this. I just want to output the variable values to see where the tests are failing.

1 Like

Hi @Nambi thank you for the issue. We are working on a fix to this at the moment, hopefully we will have this landed soon. You can take a look at this PR if you’re interested in the details. https://github.com/FuelLabs/sway/pull/5306