Skip to content

Commit

Permalink
Length Function test
Browse files Browse the repository at this point in the history
Shows the error

Type mismatch: inferred type is String but Int? was expected
  • Loading branch information
griffio committed May 3, 2023
1 parent 8ad37f7 commit 04ad12f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ selectNameLength:

selectDescriptionLength:
SELECT length(description) FROM characters;

selectLength:
SELECT length(?);
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,16 @@ class PostgreSqlTest {
assertThat(uuid).isNotNull()
}

@Test fun lengthFunction() {
@Test fun lengthFunctionReturnsCharacterCount() {
database.charactersQueries.insertCharacter("abcdef", null)
val name = database.charactersQueries.selectNameLength().executeAsOne()
assertThat(name).isEqualTo(6)
val desc = database.charactersQueries.selectDescriptionLength().executeAsOne()
assertThat(desc.length).isNull()
}

@Test fun lengthFunction() {
val length = database.charactersQueries.selectLength("abc").executeAsOne()
assertThat(length).isEqualTo(3)
}
}

0 comments on commit 04ad12f

Please sign in to comment.