Skip to content

Instantly share code, notes, and snippets.

@sahara-ooga
Created October 3, 2022 14:54
Show Gist options
  • Save sahara-ooga/6ff6edacd9894cf7351af82da24ea2d1 to your computer and use it in GitHub Desktop.
Save sahara-ooga/6ff6edacd9894cf7351af82da24ea2d1 to your computer and use it in GitHub Desktop.
simple assert function for Ruby
def assert(actual, expected)
# p "actual: #{actual}"
if actual == expected
return
else
puts "#{actual} is not equal to #{expected}!"
exit(false)
end
end
# assertメソッドのテスト
# assert(0, 1) #0 is not equal to 1! でテストコードの実行が止まる
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment