vector_to_slice.rs 597 B

123456789101112131415161718192021222324252627
  1. // SPDX-License-Identifier: Apache-2.0
  2. use crate::{build_solidity, BorshToken};
  3. #[test]
  4. fn test_slice_in_phi() {
  5. let file = r#"
  6. contract c1 {
  7. function test() public returns (string) {
  8. string ast = "Hello!";
  9. string bst = "from Solang";
  10. while (ast == bst) {
  11. ast = ast + "a";
  12. }
  13. return ast;
  14. }
  15. }
  16. "#;
  17. let mut vm = build_solidity(file);
  18. vm.constructor(&[]);
  19. let returns = vm.function("test", &[]).unwrap();
  20. assert_eq!(returns, BorshToken::String(String::from("Hello!")));
  21. }