Created
February 3, 2025 08:56
-
-
Save matsuoshi/375d4a8f330fdbbeb507f3f09c4b5ea1 to your computer and use it in GitHub Desktop.
assert for gas (google app script)
This file contains hidden or 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
| function assert(expected, actual) { | |
| const at = (new Error()).stack.split('\n')[2].trim() | |
| if (expected !== actual) { | |
| console.error('error', {expected, actual}, at) | |
| return false; | |
| } | |
| console.log('OK', {expected, actual}, at) | |
| return true; | |
| } | |
| function test_assert() { | |
| assert(1, 2) | |
| assert(1, 1) | |
| assert(1, "1") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment