Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
SBOne-Kenobi committed Sep 19, 2022
1 parent d7ff095 commit 1f3de41
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,16 @@ internal class InstanceOfExampleTest : UtValueTestCaseChecker(
)
}

@Test
fun testInstanceOfString() {
check(
InstanceOfExample::instanceOfString,
eq(2),
{ cs, r -> cs == null && r == Unit },
{ cs, r -> cs is String && r == null }
)
}


private inline fun <reified T : Any> Any?.isInstanceOfArray() =
(this as? Array<*>)?.run { T::class.java.isAssignableFrom(this::class.java.componentType) } == true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,4 +322,10 @@ public Object[] instanceOfObjectArray(Object[] array) {

return array;
}

public void instanceOfString(CharSequence cs) {
if (cs instanceof String) {
throw new IllegalStateException("CharSequence must not be a String");
}
}
}

0 comments on commit 1f3de41

Please sign in to comment.