From 7aca7f9cfb288d24fc1b9cdb134b286dd5b5daa5 Mon Sep 17 00:00:00 2001 From: Michal Pawlik Date: Wed, 18 Sep 2024 14:09:57 +0200 Subject: [PATCH] extend scripted test for snapshot promote filtering --- .../src/test/scala/OtherTest.scala | 29 +++++++++++++++++++ .../sbt-snapshot4s/promote-filter/test | 19 +++++++----- 2 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 modules/plugin/src/sbt-test/sbt-snapshot4s/promote-filter/src/test/scala/OtherTest.scala diff --git a/modules/plugin/src/sbt-test/sbt-snapshot4s/promote-filter/src/test/scala/OtherTest.scala b/modules/plugin/src/sbt-test/sbt-snapshot4s/promote-filter/src/test/scala/OtherTest.scala new file mode 100644 index 0000000..2dd2ca5 --- /dev/null +++ b/modules/plugin/src/sbt-test/sbt-snapshot4s/promote-filter/src/test/scala/OtherTest.scala @@ -0,0 +1,29 @@ +package simple + +import weaver.* +import snapshot4s.weaver.SnapshotExpectations +import snapshot4s.generated.snapshotConfig + +object OtherTest extends SimpleIOSuite with SnapshotExpectations { + + test("inline") { + assertInlineSnapshot(123, 456) + } + + test("new inline snapshot") { + assertInlineSnapshot(1, ???) + } + + test("file that doesn't exist") { + assertFileSnapshot("other-contents", "nonexistent-file") + } + + test("existing file") { + assertFileSnapshot("contents", "existing-file") + } + + test("file in nested directory") { + assertFileSnapshot("contents", "nested-directory/nested-file") + } + +} diff --git a/modules/plugin/src/sbt-test/sbt-snapshot4s/promote-filter/test b/modules/plugin/src/sbt-test/sbt-snapshot4s/promote-filter/test index 277a161..bfcf848 100644 --- a/modules/plugin/src/sbt-test/sbt-snapshot4s/promote-filter/test +++ b/modules/plugin/src/sbt-test/sbt-snapshot4s/promote-filter/test @@ -7,14 +7,17 @@ -> ++ 2.13 test -> ++ 3 test # Not update anything with invalid filter -# > snapshot4sPromote *IDontExist* -# # Tests should fail as snapshots are out of date -# -> ++ 2.12 test -# -> ++ 2.13 test -# -> ++ 3 test +> snapshot4sPromote *IDontExist* +# Tests should fail as snapshots are out of date +-> ++ 2.12 test +-> ++ 2.13 test +-> ++ 3 test # # Update snapshots with correct filter > snapshot4sPromote *FilterTest* # # Tests should succeed with updated snapshots -> ++ 2.12 test -> ++ 2.13 test -> ++ 3 test +> ++ 2.12 testOnly *FilterTest* +> ++ 2.13 testOnly *FilterTest* +> ++ 3 testOnly *FilterTest* +-> ++ 2.12 testOnly *OtherTest* +-> ++ 2.13 testOnly *OtherTest* +-> ++ 3 testOnly *OtherTest*