Skip to content

Instantly share code, notes, and snippets.

@matsuoshi
Created February 3, 2025 08:56
Show Gist options
  • Select an option

  • Save matsuoshi/375d4a8f330fdbbeb507f3f09c4b5ea1 to your computer and use it in GitHub Desktop.

Select an option

Save matsuoshi/375d4a8f330fdbbeb507f3f09c4b5ea1 to your computer and use it in GitHub Desktop.
assert for gas (google app script)
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