Last active
May 23, 2022 12:28
-
-
Save mathiasverraes/9046427 to your computer and use it in GitHub Desktop.
A unit testing framework in a tweet.
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
<?php | |
require_once 'TestFrameworkInATweet.php'; | |
it("should sum two numbers", 1+1==2); | |
it("should display an X for a failing test", 1+1==3); | |
done(); |
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
<?php | |
function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I gave up to colors, but
Example:
with output: