Skip to content

Instantly share code, notes, and snippets.

@NTCoding
Last active January 23, 2016 16:30
Show Gist options
  • Select an option

  • Save NTCoding/00be25d314f9ba66737c to your computer and use it in GitHub Desktop.

Select an option

Save NTCoding/00be25d314f9ba66737c to your computer and use it in GitHub Desktop.
// return the stubbed value if the actual arguments match the expected arguments
def ret[A,B](a: A)(b: B): A => B =
x => if (x == a) b else throw ReturnFailed(s"$x did not equal $a")
def ret[A,B,C](a: A, b: B)(c: C): (A,B) => C =
(x, y) => if (x == a && y == b) c else throw ReturnFailed(s"$x and $y did not equal $a and $b")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment