debug_buffer_format.rs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // SPDX-License-Identifier: Apache-2.0
  2. use crate::build_solidity_with_options;
  3. #[test]
  4. fn debug_buffer_format() {
  5. let mut runtime = build_solidity_with_options(
  6. r#"contract DebugBuffer {
  7. function multiple_prints() public {
  8. print("Hello!");
  9. print("I call seal_debug_message under the hood!");
  10. }
  11. function multiple_prints_then_revert() public {
  12. print("Hello!");
  13. print("I call seal_debug_message under the hood!");
  14. revert("sesa!!!");
  15. }
  16. }
  17. "#,
  18. true,
  19. );
  20. runtime.function("multiple_prints", [].to_vec());
  21. assert_eq!(
  22. runtime.debug_buffer(),
  23. r#"print: Hello!,
  24. print: I call seal_debug_message under the hood!,
  25. "#
  26. );
  27. runtime.function_expect_failure("multiple_prints_then_revert", [].to_vec());
  28. assert_eq!(
  29. runtime.debug_buffer(),
  30. r#"print: Hello!,
  31. print: I call seal_debug_message under the hood!,
  32. runtime_error: sesa!!! revert encountered in test.sol:10:17-34,
  33. "#
  34. );
  35. }