Last active
November 25, 2016 23:38
-
-
Save chiquitinxx/296ec6cd0cf4d5afe01e6693f14a877b to your computer and use it in GitHub Desktop.
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
// Elixir ideas https://quickleft.com/blog/pattern-matching-elixir/ | |
class Functions { | |
@When('!list') | |
int length(List list) { 0 } | |
@When('[heal | tail] = list') | |
int length(List list) { 1 + length(tail) } | |
@When('x > 0') | |
boolean isGreaterThanZero(x) { true } | |
//Rest of cases | |
boolean isGreaterThanZero(x) { false } | |
@When('!file || !new File(path).exists()') | |
void processFile(String path) { println 'Not exists' } | |
void processFile(String path) { | |
//do stuff | |
} | |
@When('{false, _} = {isAuthorized, data}') | |
boolean validForm(boolean isAuthorized, Map data) { false } | |
@When('{true, Countries.SPAIN} = {isAuthorized, data.country }') | |
boolean validForm(boolean isAuthorized, Map data) { | |
//do spanish stuff | |
} | |
//.. rest of countries | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment