Skip to content

Commit

Permalink
Add test failures to see the action in action
Browse files Browse the repository at this point in the history
  • Loading branch information
eygraber committed Apr 14, 2022
1 parent 1a0932c commit cfac3a9
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import kotlin.test.assertEquals

class FloatColumnAdapterTest {
@Test fun decode() {
assertEquals(10.0f, FloatColumnAdapter.decode(10.0), 1e-6f)
assertEquals(11.0f, FloatColumnAdapter.decode(10.0), 1e-6f)
}

@Test fun encode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ CREATE TABLE test (
external_event_id TEXT
);

ALTER TABLE test
ALTE TABLE test
ADD CONSTRAINT `idx_external_event_id`
UNIQUE (`external_event_id`);
UNIQUE (`external_event_id`);
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ class AndroidDriverTest : DriverTest() {
useNoBackupDirectory = false
)

assertFalse(factory.lastConfiguration.useNoBackupDirectory)
assertTrue(factory.lastConfiguration.useNoBackupDirectory)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ abstract class DriverTest {

val mapper: (SqlCursor) -> Unit = {
assertTrue(it.next())
assertEquals(1, it.getLong(0))
assertEquals(2, it.getLong(0))
assertNull(it.getLong(1))
assertNull(it.getString(2))
assertNull(it.getBytes(3))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class NativeSqliteDriverTestMemory : NativeSqliteDriverTest() {
val dbm = createDatabaseManager(config)
dbm.createMultiThreadedConnection().close()

assertFalse(closed.value)
assertTrue(closed.value)
}
}

Expand Down Expand Up @@ -409,4 +409,4 @@ abstract class NativeSqliteDriverTest : LazyDriverBaseTest() {
assertEquals(0, driver.transactionPool.entry.statementCache.size)
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class JsDriverTest {
}

query {
assertTrue(it.next())
assertFalse(it.next())
assertFalse(it.next())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class KeyedQueryPagingSourceTest {

val results = runBlocking { source.load(Refresh(key = 5L, loadSize = 2, false)) }

assertEquals(listOf(5L), (results as LoadResult.Page).data)
assertEquals(listOf(6L), (results as LoadResult.Page).data)
}

@Test fun `misaligned last page has correct data`() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MappingTest : DbTest {
.asFlow()
.mapToOne(coroutineContext)
.test {
assertEquals(Employee("alice", "Alice Allison"), awaitItem())
assertEquals(Employee("al1ce", "Alice Allison"), awaitItem())
cancel()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class MappingJvmTest : DbTest {
}
}

assertEquals(0, seen)
assertEquals(1, seen)
testScope.testScheduler.advanceUntilIdle()
assertEquals(1, seen)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import app.cash.sqldelight.Query;
import io.reactivex.schedulers.Schedulers;
import java.util.Arrays;
import java.util.Optional;
import org.junit.After;
import org.junit.Test;

import java.util.Arrays;
import java.util.Optional;

import static app.cash.sqldelight.rx2.Employee.MAPPER;
import static app.cash.sqldelight.rx2.Employee.SELECT_EMPLOYEES;
import static app.cash.sqldelight.rx2.TestDb.TABLE_EMPLOYEE;
Expand All @@ -23,7 +24,7 @@ public final class QueryJavaTest {
RxQuery.toObservable(query, Schedulers.trampoline())
.to(RxQuery::mapToOne)
.test()
.assertValue(new Employee("alice", "Alice Allison"));
.assertValue(new Employee("al1ce", "Alice Allison"));
}

@Test public void mapToOneOrDefault() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class QueryObservableTest {
.mapToList()
.test()
.assertNoValues()
.assertError(error)
.assertNoErrors()

db.close()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import app.cash.sqldelight.Query;
import io.reactivex.rxjava3.schedulers.Schedulers;
import java.util.Arrays;
import java.util.Optional;
import org.junit.After;
import org.junit.Test;

import java.util.Arrays;
import java.util.Optional;

import static app.cash.sqldelight.rx3.Employee.MAPPER;
import static app.cash.sqldelight.rx3.Employee.SELECT_EMPLOYEES;
import static app.cash.sqldelight.rx3.TestDb.TABLE_EMPLOYEE;
Expand All @@ -23,7 +24,7 @@ public final class QueryJavaTest {
RxQuery.toObservable(query, Schedulers.trampoline())
.to(RxQuery::mapToOne)
.test()
.assertValue(new Employee("alice", "Alice Allison"));
.assertValue(new Employee("al1ce", "Alice Allison"));
}

@Test public void mapToOneOrDefault() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class QueryObservableTest {
query.asObservable(Schedulers.trampoline()).mapToList()
.test()
.assertNoValues()
.assertError(error)
.assertNoErrors()
}

@Test fun mapToListThrowsFromMapFunction() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class LogSqliteDriverTest {

insert {}

assertEquals("EXECUTE\n INSERT INTO test VALUES (?, ?);", logs[0])
assertEquals("XECUTE\n INSERT INTO test VALUES (?, ?);", logs[0])
assertEquals(" [1, Alec]", logs[1])
assertEquals("EXECUTE\n INSERT INTO test VALUES (?, ?);", logs[2])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class IntegrationTest {

@Test fun `escaped named are handled correctly`() {
val allGroups = queryWrapper.groupQueries.selectAll().executeAsList()
assertThat(allGroups).containsExactly(1L, 2L, 3L)
assertThat(allGroups).containsExactly(2L, 3L)
}

@Test fun `allPlayers properly triggers from inserts`() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ImportTests {
)

assertThat(result.errors).containsExactly(
"Test.sq: (1, 0): Multiple imports for type Thing",
"est.sq: (1, 0): Multiple imports for type Thing",
"Test.sq: (2, 0): Multiple imports for type Thing"
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class MySqlTest {
time = LocalTime.of(21, 30, 59),
datetime = LocalDateTime.of(2020, 1, 1, 21, 30, 59),
timestamp = OffsetDateTime.of(1980, 4, 9, 20, 15, 45, 0, ZoneOffset.ofHours(0)),
year = "2022-01-01"
year = "2022"
)
)
}
Expand Down

0 comments on commit cfac3a9

Please sign in to comment.