Last active
August 19, 2019 19:36
-
-
Save mikesol/a99bc2c94f635b085d32f85d5d3277bc to your computer and use it in GitHub Desktop.
Kotlin code snippet
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
class _First { | |
infix fun sign(into: _Into) = into | |
} | |
class _Into { | |
infix fun your(console: _Console) { | |
// insert sign in logic, ie via Robolectric | |
return console | |
} | |
} | |
class _Console { val Then = this | |
infix fun check(your: _Your) = your | |
} | |
class _Your { | |
infix fun point(balance: _Balance) { | |
// insert code to navigate to balance-checking page, ie via Robolectric | |
return balance | |
} | |
infix fun points(to: _To) = to | |
infix fun point(balance: _Balance) { | |
// insert code to navigate to balance screen, ie via Robolectric | |
return balance | |
} | |
} | |
class _Balance { val There = this | |
val It = this | |
infix fun should(be: _Be) = be | |
infix fun should(now: _Now) = now | |
} | |
class _Be { | |
infix fun fifteen(points: _Points) { | |
// insert an assertion to make sure the number of poitns are 15 | |
return points | |
} | |
} | |
class _Points { val Then = this | |
infix fun use(all: _All) = all | |
infix fun you(have: _Have) { | |
// insert logic to purchase a ticket to Guam with your points, ie via Robolectric | |
return have | |
} | |
} | |
class _All { | |
infix fun of(your: _Your) = your | |
} | |
class _To { | |
infix fun buy(a: _A) = a | |
infix fun Guam(that: _That) = that | |
} | |
class _A { | |
infix fun ticket(to: _To) = to | |
} | |
class _That { | |
infix fun costs(exactly: _Exactly) = exactly | |
} | |
class _Exactly { | |
infix fun the(number: _Number) = number | |
} | |
class _Number { | |
infix fun of(points: _Points) = points | |
} | |
class _Have { val Then = this | |
infix fun check(your: _Your) = your | |
} | |
class _Now { | |
infix fun be(zero: _Zero) { | |
// an assertion that the current number of points are 0 | |
return zero | |
} | |
} | |
class _Zero { | |
} | |
val all = _All() | |
val to = _To() | |
val that = _That() | |
val exactly = _Exactly() | |
val number = _Number() | |
val be = _Be() | |
val a = _A() | |
val have = _Have() | |
val points = _Points() | |
val now = _Now() | |
val your = _Your() | |
val into = _Into() | |
val First = _First() | |
val zero = _Zero() | |
val console = _Console() | |
val balance = _Balance() | |
@Test | |
fun `times with kotlin`() { | |
First sign into your console. | |
Then check your point balance. There should be fifteen points. | |
Then use all of your points to buy a ticket to Guam that costs exactly the number of points you have. | |
Then check your point balance. It should now be zero. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment