diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1372bb..b28a5bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,6 +143,9 @@ jobs: mutation-tests: name: Mutation tests runs-on: ubuntu-latest + strategy: + matrix: + shard: [0, 1, 2, 3] steps: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 @@ -155,7 +158,7 @@ jobs: - uses: actions-rs/cargo@v1 with: command: mutants - args: --colors=always + args: --colors=always --no-shuffle -vV --shard ${{ matrix.shard }}/4 - name: Archive results uses: actions/upload-artifact@v3 if: failure() diff --git a/rusqlite_migration/src/tests/synch.rs b/rusqlite_migration/src/tests/synch.rs index d7d485f..a51997b 100644 --- a/rusqlite_migration/src/tests/synch.rs +++ b/rusqlite_migration/src/tests/synch.rs @@ -530,3 +530,26 @@ fn test_user_version_error() { assert!(e.is_err(), "{:?}", e); insta::assert_debug_snapshot!(e) } + +#[test] +fn test_missing_down_migration() { + let mut conn = Connection::open_in_memory().unwrap(); + let ms = vec![ + M::up("CREATE TABLE t1(a)").down("DROP TABLE t1"), + M::up("CREATE TABLE t2(a)").down("DROP TABLE t2"), + M::up("CREATE TABLE t3(a)"), + M::up("CREATE TABLE t4(a)").down("DROP TABLE t4"), + M::up("CREATE TABLE t5(a)"), + ]; + + let m = Migrations::new(ms); + m.to_version(&mut conn, 4).unwrap(); + + m.to_version(&mut conn, 3).unwrap(); + assert_eq!( + Err(Error::MigrationDefinition( + MigrationDefinitionError::DownNotDefined { migration_index: 2 } + )), + m.to_version(&mut conn, 2) + ); +} diff --git a/rusqlite_migration_tokio_async/src/lib.rs b/rusqlite_migration_tokio_async/src/lib.rs index 7d12d9a..1751e6f 100644 --- a/rusqlite_migration_tokio_async/src/lib.rs +++ b/rusqlite_migration_tokio_async/src/lib.rs @@ -8,7 +8,7 @@ mod tests { #[test] fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); + let result = add(2, 5); + assert_eq!(result, 7); } }