From f4c2a5de47649de7eb12e2b8360fd629d3703978 Mon Sep 17 00:00:00 2001 From: "Dr. Mia von Steinkirch" <1130416+F4DELEGATECALL@users.noreply.github.com> Date: Wed, 19 Oct 2022 19:02:50 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=96=20assert=20vs.=20require?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- solidity/tests/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/solidity/tests/README.md b/solidity/tests/README.md index 8d3e0a0..d897eb4 100644 --- a/solidity/tests/README.md +++ b/solidity/tests/README.md @@ -1,5 +1,14 @@ ## 🍣 tests in solidity +
+ +### assert vs. require + +* Assert() should only be used to test for internal errors, and to check invariants. +* Require() should be used to ensure valid conditions are met that cannot be detected until execution time. +* You may optionally provide a message for require, but not for assert. + +
### unit testing