forked from hyperledger-solang/solang
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use new solana mechanism for return data
Requires: - solana-labs/solana#19548 - solana-labs/solana#19318 Signed-off-by: Sean Young <sean@mess.org>
- Loading branch information
Showing
14 changed files
with
449 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
contract errors { | ||
function do_revert(bool yes) pure public returns (int) { | ||
if (yes) { | ||
revert("Do the revert thing"); | ||
} else { | ||
return 3124445; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import expect from 'expect'; | ||
import { establishConnection } from './index'; | ||
|
||
describe('Deploy solang contract and test', () => { | ||
it('errors', async function () { | ||
this.timeout(50000); | ||
|
||
let conn = await establishConnection(); | ||
|
||
let errors = await conn.loadProgram("bundle.so", "errors.abi"); | ||
|
||
// call the constructor | ||
await errors.call_constructor(conn, 'errors', []); | ||
|
||
let res = await errors.call_function(conn, "do_revert", [false]); | ||
|
||
expect(res["0"]).toBe("3124445"); | ||
|
||
let revert_res = await errors.call_function_expect_revert(conn, "do_revert", [true]); | ||
|
||
expect(revert_res).toBe("Do the revert thing"); | ||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.