Guest User

Untitled

a guest
Mar 24th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. @RunWith(JUnitPlatform::class)
  2. class ExpressionFunctionTest : Spek({
  3.  
  4. describe("one line function rule") {
  5.  
  6. it("have to specify the return type") {
  7.  
  8. val rule = ExpressionFunctionRule()
  9. assertThat(rule.lint(
  10. """
  11. fun add(a: Int, b: Int): Int = a + b
  12. """
  13. .trimIndent())
  14. ).isEqualTo(emptyList<LintError>())
  15.  
  16. assertThat(rule.lint(
  17. """
  18. fun add(a: Int, b: Int) = a + b
  19. """
  20. .trimIndent())
  21. ).isEqualTo(listOf(LintError(1, 1, "one-line-function", "need return type!!!")))
  22.  
  23. }
  24. }
  25. })
Add Comment
Please, Sign In to add comment