diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bcc79a5be..6c5419a2b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,13 +4,13 @@ - To improve our Python, go to [`python/README.md`](python/README.md) - To improve our JVM, Javascript, or WASM implementations, go to [`jvm/README.md`](jvm/README.md) - To improve the webpage of our published kdoc, [kdoc.selfie.dev](https://kdoc.selfie.dev), go to [`jvm/gradle/dokka/README.md`](jvm/gradle/dokka/README.md) -- To contribute for a different platform (python, go, etc.) we're happy to help! It should probably live in a different repo until it's close to `1.0`, but once it's near completion we're happy to maintain it here if you would like. Discuss in [selfie#85](https://github.com/diffplug/selfie/issues/85), but also feel free to open a PR with any ideas you have. +- To contribute for a different platform (python, go, etc.) we're happy to help! It should probably live in a different repo until it's close to `1.0`, but once it's near completion we're happy to maintain it here if you would like. Discuss in [selfie#85](https://github.com/diffplug/selfie-lib/issues/85), but also feel free to open a PR with any ideas you have. Pull requests are very welcome, preferably against `main`. ## License -By contributing your code, you agree to license your contribution under the terms of the APLv2: https://github.com/diffplug/selfie/blob/master/LICENSE +By contributing your code, you agree to license your contribution under the terms of the APLv2: https://github.com/diffplug/selfie-lib/blob/master/LICENSE All files are released with the Apache 2.0 license as such: diff --git a/README.md b/README.md index 9ec618454..02bec6609 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,31 @@ -# Selfie: snapshot testing and memoizing for Python, JVM, and [(your PR here)](https://github.com/diffplug/selfie/issues/85) +# Selfie: snapshot testing and memoizing for Python and JVM + +> **Moved:** this library now lives at `diffplug/selfie-lib`, with docs at [lib.selfie.dev](https://lib.selfie.dev). Maven and PyPI coordinates and the API are unchanged, so you don't need to change anything. [Read the announcement](https://github.com/diffplug/selfie-lib/issues/595). ![gif demo of selfie in action](https://docs.diffplug.com/selfie/selfie-demo.gif) ## Key features -- Just add a test dependency ([py](https://selfie.dev/py/get-started#installation), [jvm](https://selfie.dev/jvm/get-started#installation)), zero setup, zero config. -- Snapshots can be [inline literals](https://selfie.dev/py#literal) or [on disk](https://selfie.dev/py#like-a-filesystem). -- Use `expect_selfie` for testing or `cache_selfie` for [memoizing expensive API calls](https://selfie.dev/py/cache). -- Disk snapshots are automatically [garbage collected](https://github.com/diffplug/selfie/blob/main/jvm/selfie-runner-junit5/src/main/kotlin/com/diffplug/selfie/junit5/SelfieGC.kt) when the test class or test method is removed. -- Snapshots are **just strings**. Use html, json, markdown, whatever. No [magic serializers](https://selfie.dev/py/cache#roundtripping-typed-data). +- Just add a test dependency ([py](https://lib.selfie.dev/py/get-started#installation), [jvm](https://lib.selfie.dev/jvm/get-started#installation)), zero setup, zero config. +- Snapshots can be [inline literals](https://lib.selfie.dev/py#literal) or [on disk](https://lib.selfie.dev/py#like-a-filesystem). +- Use `expect_selfie` for testing or `cache_selfie` for [memoizing expensive API calls](https://lib.selfie.dev/py/cache). +- Disk snapshots are automatically [garbage collected](https://github.com/diffplug/selfie-lib/blob/main/jvm/selfie-runner-junit5/src/main/kotlin/com/diffplug/selfie/junit5/SelfieGC.kt) when the test class or test method is removed. +- Snapshots are **just strings**. Use html, json, markdown, whatever. No [magic serializers](https://lib.selfie.dev/py/cache#roundtripping-typed-data). - Record **multiple facets** of the entity under test, e.g. for a web request... - store the HTML as one facet - store HTML-rendered-to-markdown as another facet - store cookies in another facet - **assert some facets on disk, others inline** - - see gif above for live demo, detailed example [here](https://selfie.dev/py/facets#harmonizing-disk-and-inline-literals) + - see gif above for live demo, detailed example [here](https://lib.selfie.dev/py/facets#harmonizing-disk-and-inline-literals) -Python and JVM ports are both production-ready, other platforms on the way: [js](https://github.com/diffplug/selfie/issues/84), [.NET, go, ...](https://github.com/diffplug/selfie/issues/85) +Python and JVM ports are both production-ready. ## Documentation -- Quickstart **([py](https://selfie.dev/py/get-started#quickstart), [jvm](https://selfie.dev/jvm/get-started#quickstart))** -- Facets **([py](https://selfie.dev/py/facets), [jvm](https://selfie.dev/jvm/facets))** -- Caching / memoizing **([py](https://selfie.dev/py/cache), [jvm](https://selfie.dev/jvm/cache))** -- Why selfie **([py](https://selfie.dev/py), [jvm](https://selfie.dev/jvm))** +- Quickstart **([py](https://lib.selfie.dev/py/get-started#quickstart), [jvm](https://lib.selfie.dev/jvm/get-started#quickstart))** +- Facets **([py](https://lib.selfie.dev/py/facets), [jvm](https://lib.selfie.dev/jvm/facets))** +- Caching / memoizing **([py](https://lib.selfie.dev/py/cache), [jvm](https://lib.selfie.dev/jvm/cache))** +- Why selfie **([py](https://lib.selfie.dev/py), [jvm](https://lib.selfie.dev/jvm))** - API reference **([py](https://pydoc.selfie.dev/namespacemembers_func), [jvm](https://kdoc.selfie.dev/))** ## Contributing diff --git a/jvm/CHANGELOG.md b/jvm/CHANGELOG.md index 7332dd0c8..25b17b130 100644 --- a/jvm/CHANGELOG.md +++ b/jvm/CHANGELOG.md @@ -11,69 +11,71 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- This project moved to [`diffplug/selfie-lib`](https://github.com/diffplug/selfie-lib), with docs at [lib.selfie.dev](https://lib.selfie.dev). Links in error messages and POM metadata now point there. Coordinates and API are unchanged. ## [3.1.1] - 2026-05-26 ### Fixed -- `ArrayMap` no longer throws `NumberFormatException` for test case names containing very large numbers. ([#577](https://github.com/diffplug/selfie/pull/577)) +- `ArrayMap` no longer throws `NumberFormatException` for test case names containing very large numbers. ([#577](https://github.com/diffplug/selfie-lib/pull/577)) ## [3.1.0] - 2026-05-09 ### Added -- `SelfieSettingsAPI` now has overridable `testAnnotations` and `testSuperclasses` properties which allow users with custom composed annotations or Spec-like base classes to register them. ([#573](https://github.com/diffplug/selfie/pull/573)) +- `SelfieSettingsAPI` now has overridable `testAnnotations` and `testSuperclasses` properties which allow users with custom composed annotations or Spec-like base classes to register them. ([#573](https://github.com/diffplug/selfie-lib/pull/573)) ## [3.0.0] - 2026-03-02 ### Changed -- **BREAKING** Bumped Kotest from `5.x` to `6.x`. If you need Kotest `5.x` compatibility, stick with `2.5.5`. ([#559](https://github.com/diffplug/selfie/pull/559)) +- **BREAKING** Bumped Kotest from `5.x` to `6.x`. If you need Kotest `5.x` compatibility, stick with `2.5.5`. ([#559](https://github.com/diffplug/selfie-lib/pull/559)) - This breaking change only affects Kotest users. - As part of the Kotest `6.x` migration, your `AbstractProjectConfig` must either have the fully qualified name of `io.kotest.provided.ProjectConfig` or the system property `kotest.framework.config.fqn` must be set. See [Kotest docs](https://kotest.io/docs/framework/project-config.html) for more info. - The breaking changes are only within `selfie-runner-kotest`. So if you are stuck on Kotest `5.x` but want some feature or bugfix only available in a `3.x` version of Selfie, you can probably get it by grabbing the latest Selfie but using `2.5.5` for the `selfie-runner-kotest` artifact. But in the long-term, we recommend using the latest supported version of all dependencies. ## [2.5.5] - 2025-11-22 ### Fixed -- `SnapshotFileLayout` now computes root folder lazily. ([#557](https://github.com/diffplug/selfie/pull/557) partial fix for [#551](https://github.com/diffplug/selfie/issues/551)) +- `SnapshotFileLayout` now computes root folder lazily. ([#557](https://github.com/diffplug/selfie-lib/pull/557) partial fix for [#551](https://github.com/diffplug/selfie-lib/issues/551)) - Allows parallel Maven execution with surefire and failsafe plugins with `forkCount` greater than one, but it only works if `reuseForks` set to `false`. ## [2.5.4] - 2025-09-12 ### Fixed -- Unsupported test sources (such as `FieldSource`) no longer cause the JUnit5 runner to crash. ([#550](https://github.com/diffplug/selfie/pull/550) fixes [#549](https://github.com/diffplug/selfie/issues/549)) +- Unsupported test sources (such as `FieldSource`) no longer cause the JUnit5 runner to crash. ([#550](https://github.com/diffplug/selfie-lib/pull/550) fixes [#549](https://github.com/diffplug/selfie-lib/issues/549)) ### Changed -- Bump minimum required Kotest from `5.4.0` to `5.6.0` ([#535](https://github.com/diffplug/selfie/pull/535)) +- Bump minimum required Kotest from `5.4.0` to `5.6.0` ([#535](https://github.com/diffplug/selfie-lib/pull/535)) - required to fix `java.lang.NoSuchMethodError: 'long kotlin.time.Duration$Companion.milliseconds-UwyO8pc(long)'` ## [2.5.3] - 2025-05-21 ### Fixed -- Restore support for JRE 11. (fixes [#528](https://github.com/diffplug/selfie/issues/528)) +- Restore support for JRE 11. (fixes [#528](https://github.com/diffplug/selfie-lib/issues/528)) - snapshots created by `junit.jupiter.api.TestFactory` are no longer garbage-collected (#534) - support parallel testing under `junit.jupiter.execution.parallel.enabled=true` (#534) ## [2.5.2] - 2025-04-28 ### Fixed -- Off-by-one in the error message for a VCR key mismatch. ([#526](https://github.com/diffplug/selfie/pull/526)) -- Fix `StringIndexOutOfBoundsException` when an empty snapshot had a facet added. (fixes [#529](https://github.com/diffplug/selfie/issues/529)) -- Fix `ClassCastException` when multiple nested test cases need to update snapshot. (fixes [#531](https://github.com/diffplug/selfie/issues/531)) +- Off-by-one in the error message for a VCR key mismatch. ([#526](https://github.com/diffplug/selfie-lib/pull/526)) +- Fix `StringIndexOutOfBoundsException` when an empty snapshot had a facet added. (fixes [#529](https://github.com/diffplug/selfie-lib/issues/529)) +- Fix `ClassCastException` when multiple nested test cases need to update snapshot. (fixes [#531](https://github.com/diffplug/selfie-lib/issues/531)) ## [2.5.1] - 2025-03-04 ### Fixed -- Selfie VCR is now out of beta, no opt-in required. ([#525](https://github.com/diffplug/selfie/pull/525)) +- Selfie VCR is now out of beta, no opt-in required. ([#525](https://github.com/diffplug/selfie-lib/pull/525)) - ArrayMap now sorts strings with multi-digit numbers as `1 2 ... 9 10 11` instead of `1 11 2 ...`. - Improved VCR-specific error messages for determining why `//selfieonce` might not be working for a test rule. - Fixed some bugs in VCR data storage (specifically concurrency and multiple frames). ## [2.5.0] - 2025-02-21 ### Added -- Added an entrypoint `Selfie.vcrTestLocator()` for the new `VcrSelfie` class for snapshotting and replaying network traffic. ([#517](https://github.com/diffplug/selfie/pull/517/files)) +- Added an entrypoint `Selfie.vcrTestLocator()` for the new `VcrSelfie` class for snapshotting and replaying network traffic. ([#517](https://github.com/diffplug/selfie-lib/pull/517/files)) ### Fixed -- Fixed a bug when saving facets containing keys with the `]` character ([#518](https://github.com/diffplug/selfie/pull/518)) +- Fixed a bug when saving facets containing keys with the `]` character ([#518](https://github.com/diffplug/selfie-lib/pull/518)) ## [2.4.2] - 2025-01-01 ### Fixed -- A single leading space (such as in the copyright header) should not override an otherwise 100% tab-indented file. ([#506](https://github.com/diffplug/selfie/issues/506)) +- A single leading space (such as in the copyright header) should not override an otherwise 100% tab-indented file. ([#506](https://github.com/diffplug/selfie-lib/issues/506)) ## [2.4.1] - 2024-10-07 ### Fixed -- Multiline `toBe` assertions (introduced in `2.1.0` for Java pre-15) were not throwing exceptions on snapshot mismatch, now fixed. ([#479](https://github.com/diffplug/selfie/pull/479)) +- Multiline `toBe` assertions (introduced in `2.1.0` for Java pre-15) were not throwing exceptions on snapshot mismatch, now fixed. ([#479](https://github.com/diffplug/selfie-lib/pull/479)) ## [2.4.0] - 2024-10-01 ### Added -- Snapshot mismatch error messages now show a diff of the first mismatched line. ([#477](https://github.com/diffplug/selfie/pull/477)) +- Snapshot mismatch error messages now show a diff of the first mismatched line. ([#477](https://github.com/diffplug/selfie-lib/pull/477)) - before ``` Snapshot mismatch @@ -91,44 +93,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [2.3.0] - 2024-07-11 ### Added -- `DiskSelfie` now makes the `Snapshot actual` value public, so that other testing infrastructure can read from snapshotted values. ([#467](https://github.com/diffplug/selfie/pull/467)) +- `DiskSelfie` now makes the `Snapshot actual` value public, so that other testing infrastructure can read from snapshotted values. ([#467](https://github.com/diffplug/selfie-lib/pull/467)) ### Fixed -- `cacheSelfie` was missing `@JvmOverloads` on the methods with default arguments. ([#425](https://github.com/diffplug/selfie/pull/425)) +- `cacheSelfie` was missing `@JvmOverloads` on the methods with default arguments. ([#425](https://github.com/diffplug/selfie-lib/pull/425)) ## [2.2.1] - 2024-06-05 ### Fixed -- Added `Selfie.expectSelfies(Iterable items, Function toString)` for doing easy "multi-asserts" in `suspend fun` also. ([#421](https://github.com/diffplug/selfie/pull/421)) +- Added `Selfie.expectSelfies(Iterable items, Function toString)` for doing easy "multi-asserts" in `suspend fun` also. ([#421](https://github.com/diffplug/selfie-lib/pull/421)) ## [2.2.0] - 2024-06-04 ### Added -- `SelfieSettingsAPI` now has a field `javaDontUseTripleQuoteLiterals` which ensures that multiline strings are always encoded as `"` strings. ([#417](https://github.com/diffplug/selfie/pull/417)) +- `SelfieSettingsAPI` now has a field `javaDontUseTripleQuoteLiterals` which ensures that multiline strings are always encoded as `"` strings. ([#417](https://github.com/diffplug/selfie-lib/pull/417)) ## [2.1.0] - 2024-06-03 ### Added -- Added `Selfie.expectSelfies(Iterable items, Function toString)` for doing easy "multi-asserts". ([#416](https://github.com/diffplug/selfie/pull/416)) -- For java versions which don't support multiline string literals, we now encode multiline strings like so: ([#406](https://github.com/diffplug/selfie/pull/406)) +- Added `Selfie.expectSelfies(Iterable items, Function toString)` for doing easy "multi-asserts". ([#416](https://github.com/diffplug/selfie-lib/pull/416)) +- For java versions which don't support multiline string literals, we now encode multiline strings like so: ([#406](https://github.com/diffplug/selfie-lib/pull/406)) - ```java toBe("line1", "line2", "line3"); ``` ### Changed -- Bump Kotlin to 2.0.0. ([#405](https://github.com/diffplug/selfie/pull/405)) +- Bump Kotlin to 2.0.0. ([#405](https://github.com/diffplug/selfie-lib/pull/405)) ### Fixed -- Do not remove stale snapshot files when readonly is true. ([#367](https://github.com/diffplug/selfie/pull/367)) -- Provide more debugging info when a snapshot gets set multiple times. (helps with [#370](https://github.com/diffplug/selfie/issues/370)) +- Do not remove stale snapshot files when readonly is true. ([#367](https://github.com/diffplug/selfie-lib/pull/367)) +- Provide more debugging info when a snapshot gets set multiple times. (helps with [#370](https://github.com/diffplug/selfie-lib/issues/370)) ## [2.0.2] - 2024-03-20 ### Fixed -- `toBeFile` now checks for duplicate writes and throws a more helpful error message if the file doesn't exist. ([#277](https://github.com/diffplug/selfie/pull/277)) +- `toBeFile` now checks for duplicate writes and throws a more helpful error message if the file doesn't exist. ([#277](https://github.com/diffplug/selfie-lib/pull/277)) ## [2.0.1] - 2024-02-24 ### Fixed -- The `coroutines` methods used to eagerly throw an exception if they were ever called from anywhere besides a Kotest method. Now they wait until `toMatchDisk()` is called, because they can work just fine anywhere if you use `toBe`. ([#247](https://github.com/diffplug/selfie/pull/247)) +- The `coroutines` methods used to eagerly throw an exception if they were ever called from anywhere besides a Kotest method. Now they wait until `toMatchDisk()` is called, because they can work just fine anywhere if you use `toBe`. ([#247](https://github.com/diffplug/selfie-lib/pull/247)) ## [2.0.0] - 2024-02-21 ### Added -- **Memoization** ([#219](https://github.com/diffplug/selfie/pull/219) implements [#215](https://github.com/diffplug/selfie/issues/215)) +- **Memoization** ([#219](https://github.com/diffplug/selfie-lib/pull/219) implements [#215](https://github.com/diffplug/selfie-lib/issues/215)) - like `expectSelfie`, all are available as `Selfie.cacheSelfie` or as `suspend fun` in `com.diffplug.selfie.coroutines`. ```kotlin val cachedResult: ByteArray = Selfie.cacheSelfieBinary { dalleJpeg() }.toBeFile("example.jpg") @@ -136,11 +138,11 @@ val cachedResult: String = Selfie.cacheSelfie { someString() }.toBe("what it val cachedResult: T = Selfie.cacheSelfieJson { anyKotlinxSerializable() }.toBe("""{"key": "value"}""") val cachedResult: T = Selfie.cacheSelfieBinarySerializable { anyJavaIoSerializable() }.toMatchDisk() ``` -- `toBeBase64` and `toBeFile` for true binary comparison of binary snapshots and facets. ([#224](https://github.com/diffplug/selfie/pull/224)) -- spaces in multiline string literals aren't always escaped. ([#220](https://github.com/diffplug/selfie/issues/220)) +- `toBeBase64` and `toBeFile` for true binary comparison of binary snapshots and facets. ([#224](https://github.com/diffplug/selfie-lib/pull/224)) +- spaces in multiline string literals aren't always escaped. ([#220](https://github.com/diffplug/selfie-lib/issues/220)) - if the leading spaces in the string literal match the file's existing indentation ### Changed -- **BREAKING** reordered a class hierarchy for better binary support. ([#221](https://github.com/diffplug/selfie/issues/221)) +- **BREAKING** reordered a class hierarchy for better binary support. ([#221](https://github.com/diffplug/selfie-lib/issues/221)) - most users won't need to make any changes at all - only exception is that `expectSelfie(byte[]).toBe` is now a compile error, must do `toBeBase64` @@ -151,31 +153,31 @@ val cachedResult: T = Selfie.cacheSelfieBinarySerializable { anyJavaIoSe - Instead of calling `Selfie.expectSelfie`, call `com.diffplug.selfie.coroutines.expectSelfie`. - `selfie-runner-junit5` supports snapshots in regular JUnit tests and Kotest tests in the same project. - `selfie-runner-kotest` is a new selfie implemented in Kotlin Multiplatform, but doesn't support snapshots within regular JUnit tests. - - Full docs at https://selfie.dev/jvm/kotest. + - Full docs at https://lib.selfie.dev/jvm/kotest. ### Fixed -- Swap thread-local cache for thread-ignorant LRU to improve performance when used with coroutines. ([#191](https://github.com/diffplug/selfie/pull/191)) +- Swap thread-local cache for thread-ignorant LRU to improve performance when used with coroutines. ([#191](https://github.com/diffplug/selfie-lib/pull/191)) ### Changes -- (no user-facing changes) replaced terrible platform-specific `Path` with `TypedPath`. ([#184](https://github.com/diffplug/selfie/pull/184)) -- (no user-facing changes) replaced `SnapshotStorage` with `SnapshotSystem` + `DiskStorage`. ([#198](https://github.com/diffplug/selfie/pull/198)) -- (no user-facing changes) replaced most `synchronized` with CAS. ([#199](https://github.com/diffplug/selfie/pull/199)) +- (no user-facing changes) replaced terrible platform-specific `Path` with `TypedPath`. ([#184](https://github.com/diffplug/selfie-lib/pull/184)) +- (no user-facing changes) replaced `SnapshotStorage` with `SnapshotSystem` + `DiskStorage`. ([#198](https://github.com/diffplug/selfie-lib/pull/198)) +- (no user-facing changes) replaced most `synchronized` with CAS. ([#199](https://github.com/diffplug/selfie-lib/pull/199)) ## [1.1.2] - 2024-01-30 ### Fixed -- `@ParameterizedTest` no longer has. ([#140](https://github.com/diffplug/selfie/issues/140)) -- If a test class contained package-private methods and a single test method was run without the others, selfie would erroneously garbage collect disk snapshots for the other methods, now fixed. ([#175](https://github.com/diffplug/selfie/pull/175) fixes [#174](https://github.com/diffplug/selfie/issues/174)) +- `@ParameterizedTest` no longer has. ([#140](https://github.com/diffplug/selfie-lib/issues/140)) +- If a test class contained package-private methods and a single test method was run without the others, selfie would erroneously garbage collect disk snapshots for the other methods, now fixed. ([#175](https://github.com/diffplug/selfie-lib/pull/175) fixes [#174](https://github.com/diffplug/selfie-lib/issues/174)) ## [1.1.1] - 2024-01-25 ### Fixed -- Selfie was erroneously garbage collecting snapshots when a test class contained no `@Test public` methods. ([#124](https://github.com/diffplug/selfie/pull/124) fixes [#123](https://github.com/diffplug/selfie/issues/123)) +- Selfie was erroneously garbage collecting snapshots when a test class contained no `@Test public` methods. ([#124](https://github.com/diffplug/selfie-lib/pull/124) fixes [#123](https://github.com/diffplug/selfie-lib/issues/123)) ## [1.1.0] - 2024-01-21 ### Added -- Support for `@ParameterizedTest`. ([#118](https://github.com/diffplug/selfie/pull/118)) -- `ArraySet` has been added to the standard library alongside `ArrayMap`. ([#119](https://github.com/diffplug/selfie/pull/119)) +- Support for `@ParameterizedTest`. ([#118](https://github.com/diffplug/selfie-lib/pull/118)) +- `ArraySet` has been added to the standard library alongside `ArrayMap`. ([#119](https://github.com/diffplug/selfie-lib/pull/119)) - These have the strange property that if the key is `String`, then `/` characters are sorted to be the lowest possible character. ### Fixed -- We already [smuggle errors from initialization](https://github.com/diffplug/selfie/pull/94) to help debug them, and now we also smuggle errors that happen during test execution. ([#117](https://github.com/diffplug/selfie/pull/117)) -- Fix a garbage collection bug which occurred when a test method's name was a prefix of another test method's name. ([#119](https://github.com/diffplug/selfie/pull/119)) +- We already [smuggle errors from initialization](https://github.com/diffplug/selfie-lib/pull/94) to help debug them, and now we also smuggle errors that happen during test execution. ([#117](https://github.com/diffplug/selfie-lib/pull/117)) +- Fix a garbage collection bug which occurred when a test method's name was a prefix of another test method's name. ([#119](https://github.com/diffplug/selfie-lib/pull/119)) ## [1.0.1] - 2024-01-19 ### Fixed @@ -183,14 +185,14 @@ val cachedResult: T = Selfie.cacheSelfieBinarySerializable { anyJavaIoSe ## [1.0.0] - 2024-01-18 ### Added -- Full support for binary snapshots. ([#108](https://github.com/diffplug/selfie/pull/108)) +- Full support for binary snapshots. ([#108](https://github.com/diffplug/selfie-lib/pull/108)) ### Fixed -- Groovy multiline string values just go into `"` strings instead of `"""` until we have a chance to implement them properly. ([#107](https://github.com/diffplug/selfie/pull/107)) +- Groovy multiline string values just go into `"` strings instead of `"""` until we have a chance to implement them properly. ([#107](https://github.com/diffplug/selfie-lib/pull/107)) ## [0.3.0] - 2024-01-17 ### Added - `toBe("mismatched")` now gets rewritten in write mode -- fully implemented the new control scheme ([#74](https://github.com/diffplug/selfie/issues/74)) +- fully implemented the new control scheme ([#74](https://github.com/diffplug/selfie-lib/issues/74)) - integers get `_` separators for thousands, millions, etc ### Known broken - Groovy multiline strings diff --git a/jvm/README.md b/jvm/README.md index 257624534..781e9d770 100644 --- a/jvm/README.md +++ b/jvm/README.md @@ -1,8 +1,8 @@ # Selfie snapshot testing for Java, Kotlin, and the JVM -- High-level documentation - [selfie.dev](https://selfie.dev/jvm/get-started). +- High-level documentation - [lib.selfie.dev](https://lib.selfie.dev/jvm/get-started). - API documentation - [pydoc.selfie.dev](https://kdoc.selfie.dev). -- Source code - [github.com/diffplug/selfie](https://github.com/diffplug/selfie) +- Source code - [github.com/diffplug/selfie-lib](https://github.com/diffplug/selfie-lib) ## Contributing diff --git a/jvm/example-junit5/README.md b/jvm/example-junit5/README.md index 347e59f32..ba76ff0d2 100644 --- a/jvm/example-junit5/README.md +++ b/jvm/example-junit5/README.md @@ -1,3 +1,3 @@ The purpose of this project is to demonstrate selfie for the manual. -Go to [https://selfie.dev/jvm/advanced](https://selfie.dev/jvm/advanced). \ No newline at end of file +Go to [https://lib.selfie.dev/jvm/advanced](https://lib.selfie.dev/jvm/advanced). \ No newline at end of file diff --git a/jvm/example-junit5/src/test/java/com/example/DemoGif.java b/jvm/example-junit5/src/test/java/com/example/DemoGif.java index 403ab740b..91505b5ae 100644 --- a/jvm/example-junit5/src/test/java/com/example/DemoGif.java +++ b/jvm/example-junit5/src/test/java/com/example/DemoGif.java @@ -8,6 +8,6 @@ public class DemoGif { @Test void homepage() { - expectSelfie(RestAssured.get("https://selfie.dev")); + expectSelfie(RestAssured.get("https://lib.selfie.dev")); } } diff --git a/jvm/gradle.properties b/jvm/gradle.properties index deef1ea71..1f441fe95 100644 --- a/jvm/gradle.properties +++ b/jvm/gradle.properties @@ -1,5 +1,5 @@ license=apache -git_url=github.com/diffplug/selfie +git_url=github.com/diffplug/selfie-lib maven_group=com.diffplug.selfie javadoc_links= org.gradle.configuration-cache=true diff --git a/jvm/gradle/dokka/README.md b/jvm/gradle/dokka/README.md index 9e2b9abea..3b5ae8bf5 100644 --- a/jvm/gradle/dokka/README.md +++ b/jvm/gradle/dokka/README.md @@ -1,4 +1,4 @@ -This gets deployed to [kdoc.selfie.dev](https://kdoc.selfie.dev) by [this CI script](https://github.com/diffplug/selfie/blob/main/.github/workflows/jvm-publish-kdoc.yml) which runs on every push to `release`. +This gets deployed to [kdoc.selfie.dev](https://kdoc.selfie.dev) by [this CI script](https://github.com/diffplug/selfie-lib/blob/main/.github/workflows/jvm-publish-kdoc.yml) which runs on every push to `release`. Full info is available at https://kotlinlang.org/docs/dokka-html.html diff --git a/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/Lens.kt b/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/Lens.kt index 31d4339f0..3ca2f316c 100644 --- a/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/Lens.kt +++ b/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/Lens.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 DiffPlug + * Copyright (C) 2023-2026 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ import kotlin.jvm.JvmStatic /** * A camera transforms a subject of a specific type into a [Snapshot] (tutorial for - * [jvm](https://selfie.dev/jvm/advanced#typed-snapshots)). + * [jvm](https://lib.selfie.dev/jvm/advanced#typed-snapshots)). */ fun interface Camera { fun snapshot(subject: Subject): Snapshot @@ -38,7 +38,7 @@ fun interface Camera { /** * A lens transforms a single [Snapshot] into a new [Snapshot], transforming / creating / removing - * [SnapshotValue]s along the way (tutorial for [jvm](https://selfie.dev/jvm/advanced#lenses)). + * [SnapshotValue]s along the way (tutorial for [jvm](https://lib.selfie.dev/jvm/advanced#lenses)). */ fun interface Lens { fun transform(snapshot: Snapshot): Snapshot @@ -54,7 +54,7 @@ fun interface StringOptionalFunction { /** * A lens which makes it easy to pipe data from one facet to another within a snapshot (tutorial for - * [jvm](https://selfie.dev/jvm/advanced#compound-lens)). + * [jvm](https://lib.selfie.dev/jvm/advanced#compound-lens)). */ open class CompoundLens : Lens { private val lenses = mutableListOf() diff --git a/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/SnapshotFile.kt b/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/SnapshotFile.kt index a11fe6507..eb0174eb6 100644 --- a/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/SnapshotFile.kt +++ b/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/SnapshotFile.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2025 DiffPlug + * Copyright (C) 2023-2026 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,10 +78,12 @@ private constructor( if (key.isEmpty()) throw IllegalArgumentException("The empty string is reserved for the subject.") else Snapshot(subject, facetData.plus(unixNewlines(key), value)) + /** Adds or replaces the given facet or subject (subject is key=""). */ fun plusOrReplace(key: String, value: SnapshotValue): Snapshot = if (key.isEmpty()) Snapshot(value, facetData) else Snapshot(subject, facetData.plusOrNoOpOrReplace(unixNewlines(key), value)) + /** Retrieves the given facet or subject (subject is key=""). */ fun subjectOrFacetMaybe(key: String): SnapshotValue? = if (key.isEmpty()) subject else facetData[key] @@ -382,11 +384,11 @@ class SnapshotValueReader(val lineReader: LineReader) { private const val FLAG_BASE64 = " ═╗ base64" /** - * https://github.com/diffplug/selfie/blob/main/jvm/selfie-lib/src/commonTest/resources/com/diffplug/selfie/scenarios_and_lenses.ss + * https://github.com/diffplug/selfie-lib/blob/main/jvm/selfie-lib/src/commonTest/resources/com/diffplug/selfie/scenarios_and_lenses.ss */ internal val nameEsc = PerCharacterEscaper.specifiedEscape("\\\\[(])\nn\tt╔┌╗┐═─") - /** https://github.com/diffplug/selfie/issues/2 */ + /** https://github.com/diffplug/selfie-lib/issues/2 */ internal val bodyEsc = PerCharacterEscaper.selfEscape("\uD801\uDF43\uD801\uDF41") } } diff --git a/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/coroutines/Coroutines.kt b/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/coroutines/Coroutines.kt index 3d41196d2..e5b70c0e2 100644 --- a/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/coroutines/Coroutines.kt +++ b/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/coroutines/Coroutines.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 DiffPlug + * Copyright (C) 2024-2026 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ If this is a Kotest test, make sure you added `SelfieExtension` to your `Abstrac If this is a JUnit test, make the following change: -import com.diffplug.selfie.coroutines.expectSelfie +import com.diffplug.selfie.Selfie.expectSelfie -For more info https://selfie.dev/jvm/kotest#selfie-and-coroutines""" +For more info https://lib.selfie.dev/jvm/kotest#selfie-and-coroutines""" private object DiskStorageError : DiskStorage { override fun readDisk(sub: String, call: CallStack) = throw IllegalStateException(WRONG_COROUTINE) diff --git a/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/Literals.kt b/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/Literals.kt index 52d46ceca..dccc61d51 100644 --- a/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/Literals.kt +++ b/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/Literals.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 DiffPlug + * Copyright (C) 2023-2026 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -131,10 +131,10 @@ internal object LiteralString : LiteralFormat() { else when (language) { // TODO: support triple-quoted strings in scala - // https://github.com/diffplug/selfie/issues/106 + // https://github.com/diffplug/selfie-lib/issues/106 Language.SCALA, // TODO: support triple-quoted strings in groovy - // https://github.com/diffplug/selfie/issues/105 + // https://github.com/diffplug/selfie-lib/issues/105 Language.GROOVY, Language.JAVA_PRE15 -> encodeMultiAsSingleJava(value) Language.JAVA -> encodeMultiJava(value, encodingPolicy) @@ -153,10 +153,10 @@ internal object LiteralString : LiteralFormat() { when (language) { Language.SCALA -> throw UnsupportedOperationException( - "Selfie doesn't support triple-quoted strings in Scala, yet - help wanted: https://github.com/diffplug/selfie/issues/106") + "Selfie doesn't support triple-quoted strings in Scala, yet - help wanted: https://github.com/diffplug/selfie-lib/issues/106") Language.GROOVY -> throw UnsupportedOperationException( - "Selfie doesn't support triple-quoted strings in Groovy, yet - help wanted: https://github.com/diffplug/selfie/issues/105") + "Selfie doesn't support triple-quoted strings in Groovy, yet - help wanted: https://github.com/diffplug/selfie-lib/issues/105") Language.JAVA_PRE15, Language.JAVA -> parseMultiJava(str) Language.KOTLIN -> parseMultiKotlin(str) diff --git a/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/SourceFile.kt b/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/SourceFile.kt index 2998d8ed6..db35ff5bf 100644 --- a/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/SourceFile.kt +++ b/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/SourceFile.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 DiffPlug + * Copyright (C) 2023-2026 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ class SourceFile(filename: String, content: String, val language: Language) { "There is an error in " + literalValue.format::class.simpleName + ", the following value isn't round tripping.\n" + - "Please this error and the data below at https://github.com/diffplug/selfie/issues/new\n" + + "Please this error and the data below at https://github.com/diffplug/selfie-lib/issues/new\n" + "```\n" + "ORIGINAL\n" + literalValue.actual + diff --git a/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/WriteTracker.kt b/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/WriteTracker.kt index b1818d9a6..d515a3c28 100644 --- a/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/WriteTracker.kt +++ b/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/WriteTracker.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 DiffPlug + * Copyright (C) 2023-2026 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,10 +21,13 @@ import com.diffplug.selfie.Snapshot expect class CallLocation : Comparable { val fileName: String? val line: Int + /** Returns a new CallLocation at the given line. */ fun withLine(line: Int): CallLocation + /** Returns a string which an IDE can render as a hyperlink. */ fun ideLink(layout: SnapshotFileLayout): String + /** * Computing the exact path using [SnapshotFileLayout.sourcePathForCall] is expensive, so it can * be helpful to cache these. @@ -127,6 +130,7 @@ class ToBeFileWriteTracker : WriteTracker() { class ToBeFileLazyBytes(val location: TypedPath, val layout: SnapshotFileLayout, data: ByteArray) { /** When constructed, we always have the data. */ var data: ByteArray? = data + /** * Shortly after being construted, this data is written to disk, and we can stop holding it in * memory. @@ -136,11 +140,13 @@ class ToBeFileLazyBytes(val location: TypedPath, val layout: SnapshotFileLayout, ?: throw IllegalStateException("Data has already been written to disk!") data = null } + /** * If we need to read our data, we do it from memory if it's still there, or from disk if it * isn't. */ private fun readData(): ByteArray = data ?: layout.fs.fileReadBinary(location) + /** We calculate equality based on this data. */ override fun equals(other: Any?): Boolean = if (this === other) true @@ -162,12 +168,12 @@ class InlineWriteTracker : WriteTracker>() { content.parseToBeLike(call.location.line).parseLiteral(literalValue.format) } catch (e: Exception) { throw AssertionError( - "Error while parsing the literal at ${call.location.ideLink(layout)}. Please report this error at https://github.com/diffplug/selfie", + "Error while parsing the literal at ${call.location.ideLink(layout)}. Please report this error at https://github.com/diffplug/selfie-lib", e) } if (parsedValue != literalValue.expected) { throw layout.fs.assertFailed( - "Selfie cannot modify the literal at ${call.location.ideLink(layout)} because Selfie has a parsing bug. Please report this error at https://github.com/diffplug/selfie", + "Selfie cannot modify the literal at ${call.location.ideLink(layout)} because Selfie has a parsing bug. Please report this error at https://github.com/diffplug/selfie-lib", literalValue.expected, parsedValue) } diff --git a/jvm/selfie-runner-junit5/README.md b/jvm/selfie-runner-junit5/README.md index 49461fd98..abceaf001 100644 --- a/jvm/selfie-runner-junit5/README.md +++ b/jvm/selfie-runner-junit5/README.md @@ -3,8 +3,8 @@
-A selfie test runner for junit5, junit4 (via junit-vintage), and Kotest JVM. High level docs for this live at [selfie.dev](https://selfie.dev/jvm/get-started). +A selfie test runner for junit5, junit4 (via junit-vintage), and Kotest JVM. High level docs for this live at [lib.selfie.dev](https://lib.selfie.dev/jvm/get-started). -See [here](https://github.com/diffplug/selfie/tree/main/jvm) for how to contribute. +See [here](https://github.com/diffplug/selfie-lib/tree/main/jvm) for how to contribute.
\ No newline at end of file diff --git a/jvm/selfie-runner-junit5/src/main/kotlin/com/diffplug/selfie/junit5/SelfieExtension.kt b/jvm/selfie-runner-junit5/src/main/kotlin/com/diffplug/selfie/junit5/SelfieExtension.kt index 843c7e2a3..ffdd8902d 100644 --- a/jvm/selfie-runner-junit5/src/main/kotlin/com/diffplug/selfie/junit5/SelfieExtension.kt +++ b/jvm/selfie-runner-junit5/src/main/kotlin/com/diffplug/selfie/junit5/SelfieExtension.kt @@ -31,7 +31,7 @@ import kotlinx.coroutines.withContext /** * If you're using Kotest, add this to your [AbstractProjectConfig]. See - * [here](https://selfie.dev/jvm/kotest) for high-level docs. + * [here](https://lib.selfie.dev/jvm/kotest) for high-level docs. */ class SelfieExtension(projectConfig: AbstractProjectConfig) : Extension, BeforeSpecListener, TestCaseExtension, FinalizeSpecListener, AfterProjectListener { diff --git a/jvm/selfie-runner-junit5/src/main/kotlin/com/diffplug/selfie/junit5/SnapshotSystemJUnit5.kt b/jvm/selfie-runner-junit5/src/main/kotlin/com/diffplug/selfie/junit5/SnapshotSystemJUnit5.kt index 23868ecbe..205d114b0 100644 --- a/jvm/selfie-runner-junit5/src/main/kotlin/com/diffplug/selfie/junit5/SnapshotSystemJUnit5.kt +++ b/jvm/selfie-runner-junit5/src/main/kotlin/com/diffplug/selfie/junit5/SnapshotSystemJUnit5.kt @@ -130,7 +130,7 @@ internal object SnapshotSystemJUnit5 : SnapshotSystem { No JUnit test is in progress on this thread. If this is a Kotest test, make the following change: -import com.diffplug.selfie.Selfie.expectSelfie +import com.diffplug.selfie.coroutines.expectSelfie - For more info https://selfie.dev/jvm/kotest#selfie-and-coroutines + For more info https://lib.selfie.dev/jvm/kotest#selfie-and-coroutines """ .trimIndent()) internal fun startThreadLocal(clazz: SnapshotFileProgress, test: String) { diff --git a/jvm/selfie-runner-junit5/src/test/kotlin/com/diffplug/selfie/junit5/HarnessJUnit.kt b/jvm/selfie-runner-junit5/src/test/kotlin/com/diffplug/selfie/junit5/HarnessJUnit.kt index 4a318d18f..02c6c31a1 100644 --- a/jvm/selfie-runner-junit5/src/test/kotlin/com/diffplug/selfie/junit5/HarnessJUnit.kt +++ b/jvm/selfie-runner-junit5/src/test/kotlin/com/diffplug/selfie/junit5/HarnessJUnit.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 DiffPlug + * Copyright (C) 2023-2026 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -161,6 +161,7 @@ open class HarnessJUnit() { assert(lines.size >= endInclusive) } fun shrinkByOne() = LineRange(lines, startInclusive + 1, endInclusive - 1) + /** Prepend `//` to every line in this range and save it to disk. */ fun commentOut() = mutateLinesAndWriteToDisk { lineNumber, line -> if (line.trim().startsWith("//")) { @@ -192,13 +193,13 @@ open class HarnessJUnit() { fun content() = lines.subList(startInclusive, endInclusive + 1).joinToString("\n") fun setContent(mustBe: String) { FileSystem.SYSTEM.write(subprojectFolder.resolve(subpath)) { - for (i in 0 ..< startInclusive) { + for (i in 0..
-A selfie test runner for [Kotest](https://kotest.io/docs/framework/framework.html) (written in Kotlin Multiplatform). High level docs for this live at [selfie.dev](https://selfie.dev/jvm/kotest). +A selfie test runner for [Kotest](https://kotest.io/docs/framework/framework.html) (written in Kotlin Multiplatform). High level docs for this live at [lib.selfie.dev](https://lib.selfie.dev/jvm/kotest). -See [here](https://github.com/diffplug/selfie/tree/main/jvm) for how to contribute. +See [here](https://github.com/diffplug/selfie-lib/tree/main/jvm) for how to contribute.
\ No newline at end of file diff --git a/jvm/selfie-runner-kotest/src/commonMain/kotlin/com/diffplug/selfie/kotest/SelfieExtension.kt b/jvm/selfie-runner-kotest/src/commonMain/kotlin/com/diffplug/selfie/kotest/SelfieExtension.kt index 255e9f00c..8ade86f54 100644 --- a/jvm/selfie-runner-kotest/src/commonMain/kotlin/com/diffplug/selfie/kotest/SelfieExtension.kt +++ b/jvm/selfie-runner-kotest/src/commonMain/kotlin/com/diffplug/selfie/kotest/SelfieExtension.kt @@ -33,7 +33,7 @@ import kotlinx.coroutines.currentCoroutineContext import kotlinx.coroutines.withContext /** - * Add this to your [AbstractProjectConfig], see [here](https://selfie.dev/jvm/kotest) for + * Add this to your [AbstractProjectConfig], see [here](https://lib.selfie.dev/jvm/kotest) for * high-level docs. */ class SelfieExtension( diff --git a/jvm/selfie-runner-kotest/src/commonMain/kotlin/com/diffplug/selfie/kotest/SnapshotSystemKotest.kt b/jvm/selfie-runner-kotest/src/commonMain/kotlin/com/diffplug/selfie/kotest/SnapshotSystemKotest.kt index 03d1da1a7..0ee00f2de 100644 --- a/jvm/selfie-runner-kotest/src/commonMain/kotlin/com/diffplug/selfie/kotest/SnapshotSystemKotest.kt +++ b/jvm/selfie-runner-kotest/src/commonMain/kotlin/com/diffplug/selfie/kotest/SnapshotSystemKotest.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 DiffPlug + * Copyright (C) 2024-2026 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,7 +77,7 @@ internal class SnapshotSystemKotest(settings: SelfieSettingsAPI) : SnapshotSyste You can fix this by making the following change: -import com.diffplug.selfie.Selfie.expectSelfie +import com.diffplug.selfie.coroutines.expectSelfie - For more info https://selfie.dev/jvm/kotest#selfie-and-coroutines + For more info https://lib.selfie.dev/jvm/kotest#selfie-and-coroutines """ .trimIndent()) internal fun finishedAllTests() { @@ -145,6 +145,7 @@ internal class SnapshotFileProgress(val system: SnapshotSystemKotest, val classO assertNotTerminated() tests.updateAndGet { it.plusOrNoOp(test, WithinTestGC()) } } + /** * Stops assigning this thread to store snapshots within this file at `test`, and if successful * marks that all other snapshots of this test can be pruned. A single test can be run multiple @@ -211,6 +212,7 @@ internal class SnapshotFileProgress(val system: SnapshotSystemKotest, val classO // now that we are done, allow our contents to be GC'ed file = null } + // the methods below are called from the test thread for I/O on snapshots fun keep(test: String, suffixOrAll: String?) { assertNotTerminated() diff --git a/jvm/undertest-junit5-kotest/harness/README.md b/jvm/undertest-junit5-kotest/harness/README.md index 004c3a545..fd55af03e 100644 --- a/jvm/undertest-junit5-kotest/harness/README.md +++ b/jvm/undertest-junit5-kotest/harness/README.md @@ -1,3 +1,3 @@ -This whole "harness" thing is just a workaround for https://github.com/diffplug/selfie/issues/203 +This whole "harness" thing is just a workaround for https://github.com/diffplug/selfie-lib/issues/203 Hopefully in a new future version of Gradle we could remove it. diff --git a/jvm/undertest-junit5-kotest/harness/gradle.properties b/jvm/undertest-junit5-kotest/harness/gradle.properties index 4f7535859..3b3164c7a 100644 --- a/jvm/undertest-junit5-kotest/harness/gradle.properties +++ b/jvm/undertest-junit5-kotest/harness/gradle.properties @@ -1,5 +1,5 @@ license=apache -git_url=github.com/diffplug/selfie +git_url=github.com/diffplug/selfie-lib maven_group=com.diffplug.selfie javadoc_links= org.gradle.configuration-cache=true diff --git a/jvm/undertest-junit5-kotest/src/test/kotlin/undertest/junit5/UT_WrongContextInJUnitKotest.kt b/jvm/undertest-junit5-kotest/src/test/kotlin/undertest/junit5/UT_WrongContextInJUnitKotest.kt index 8770cec4c..ec2ec021d 100644 --- a/jvm/undertest-junit5-kotest/src/test/kotlin/undertest/junit5/UT_WrongContextInJUnitKotest.kt +++ b/jvm/undertest-junit5-kotest/src/test/kotlin/undertest/junit5/UT_WrongContextInJUnitKotest.kt @@ -15,7 +15,7 @@ class UT_WrongContextInJUnitKotest : """No JUnit test is in progress on this thread. If this is a Kotest test, make the following change: ${' '} -import com.diffplug.selfie.Selfie.expectSelfie ${' '} +import com.diffplug.selfie.coroutines.expectSelfie -For more info https://selfie.dev/jvm/kotest#selfie-and-coroutines""") +For more info https://lib.selfie.dev/jvm/kotest#selfie-and-coroutines""") } } }) diff --git a/jvm/undertest-junit5/src/test/kotlin/undertest/junit5/UT_WrongContextInJUnit.kt b/jvm/undertest-junit5/src/test/kotlin/undertest/junit5/UT_WrongContextInJUnit.kt index 8a155436e..c4242c9d7 100644 --- a/jvm/undertest-junit5/src/test/kotlin/undertest/junit5/UT_WrongContextInJUnit.kt +++ b/jvm/undertest-junit5/src/test/kotlin/undertest/junit5/UT_WrongContextInJUnit.kt @@ -18,7 +18,7 @@ ${' '} +} If this is a JUnit test, make the following change: ${' '} -import com.diffplug.selfie.coroutines.expectSelfie ${' '} +import com.diffplug.selfie.Selfie.expectSelfie -For more info https://selfie.dev/jvm/kotest#selfie-and-coroutines""") +For more info https://lib.selfie.dev/jvm/kotest#selfie-and-coroutines""") } } } diff --git a/jvm/undertest-kotest/src/commonTest/kotlin/undertest/kotest/UT_WrongContextInKotest.kt b/jvm/undertest-kotest/src/commonTest/kotlin/undertest/kotest/UT_WrongContextInKotest.kt index 3bffc00b6..eadf3e4bb 100644 --- a/jvm/undertest-kotest/src/commonTest/kotlin/undertest/kotest/UT_WrongContextInKotest.kt +++ b/jvm/undertest-kotest/src/commonTest/kotlin/undertest/kotest/UT_WrongContextInKotest.kt @@ -16,7 +16,7 @@ class UT_WrongContextInKotest : You can fix this by making the following change: ${' '} -import com.diffplug.selfie.Selfie.expectSelfie ${' '} +import com.diffplug.selfie.coroutines.expectSelfie -For more info https://selfie.dev/jvm/kotest#selfie-and-coroutines""") +For more info https://lib.selfie.dev/jvm/kotest#selfie-and-coroutines""") } } }) diff --git a/python/CHANGELOG.md b/python/CHANGELOG.md index 4e489852c..bab68698a 100644 --- a/python/CHANGELOG.md +++ b/python/CHANGELOG.md @@ -10,8 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), Allowable headings are `Added`, `Fixed`, and `Changed`. ## [Unreleased] +### Changed +- This project moved to [`diffplug/selfie-lib`](https://github.com/diffplug/selfie-lib), with docs at [lib.selfie.dev](https://lib.selfie.dev). Links in error messages and docs now point there. Coordinates and API are unchanged. ### Fixed -- A single leading space (such as in the copyright header) should not override an otherwise 100% tab-indented file. ([#506](https://github.com/diffplug/selfie/issues/506)) +- A single leading space (such as in the copyright header) should not override an otherwise 100% tab-indented file. ([#506](https://github.com/diffplug/selfie-lib/issues/506)) ## [1.0.0] - 2024-12-16 diff --git a/python/README.md b/python/README.md index 814fcd996..46f2e8cca 100644 --- a/python/README.md +++ b/python/README.md @@ -1,8 +1,8 @@ # Selfie snapshot testing for Python -- High-level documentation - [selfie.dev](https://selfie.dev/py/get-started). +- High-level documentation - [lib.selfie.dev](https://lib.selfie.dev/py/get-started). - API documentation - [pydoc.selfie.dev](https://pydoc.selfie.dev/namespaces). -- Source code - [github.com/diffplug/selfie](https://github.com/diffplug/selfie) +- Source code - [github.com/diffplug/selfie-lib](https://github.com/diffplug/selfie-lib) ## Contributing diff --git a/python/example-pytest-selfie/README.md b/python/example-pytest-selfie/README.md index fc952aac8..8054d4846 100644 --- a/python/example-pytest-selfie/README.md +++ b/python/example-pytest-selfie/README.md @@ -1,6 +1,6 @@ The purpose of this project is to demonstrate selfie for the manual. -Go to https://selfie.dev/py/facets for the tutorial. +Go to https://lib.selfie.dev/py/facets for the tutorial. - First run `uv sync` - You can run the app locally with `uv run python app.py` diff --git a/python/example-pytest-selfie/tests/binary_test.py b/python/example-pytest-selfie/tests/binary_test.py index 0bb9e64d1..eb91d7370 100644 --- a/python/example-pytest-selfie/tests/binary_test.py +++ b/python/example-pytest-selfie/tests/binary_test.py @@ -41,7 +41,7 @@ def test_binary_file_duplicate_unequal(): "tests/binary_test__test_binary_file_duplicate_unequal.bin" ) expect_selfie(safify(str(exc_info.value))).to_be( - "Snapshot mismatch (error msg could be better https://github.com/diffplug/selfie/issues/501)" + "Snapshot mismatch (error msg could be better https://github.com/diffplug/selfie-lib/issues/501)" ) @@ -65,7 +65,7 @@ def test_base64_mismatch(): with pytest.raises(Exception) as exc_info: expect_selfie(b"test data").to_be_base64("AAAA") expect_selfie(safify(str(exc_info.value))).to_be( - "Snapshot mismatch (error msg could be better https://github.com/diffplug/selfie/issues/501)" + "Snapshot mismatch (error msg could be better https://github.com/diffplug/selfie-lib/issues/501)" ) diff --git a/python/pytest-selfie/README.md b/python/pytest-selfie/README.md index 266d8096f..4ba0443b5 100644 --- a/python/pytest-selfie/README.md +++ b/python/pytest-selfie/README.md @@ -2,4 +2,4 @@ This package makes selfie snapshot testing available for use in pytest. -See the [get started guide here](https://selfie.dev/py/get-started). +See the [get started guide here](https://lib.selfie.dev/py/get-started). diff --git a/python/selfie-lib/README.md b/python/selfie-lib/README.md index bfe7f9762..c7c38fe48 100644 --- a/python/selfie-lib/README.md +++ b/python/selfie-lib/README.md @@ -2,4 +2,4 @@ This package is the API and logic for selfie snapshot testing. -See the [get started guide here](https://selfie.dev/py/get-started). +See the [get started guide here](https://lib.selfie.dev/py/get-started). diff --git a/python/selfie-lib/selfie_lib/SnapshotSystem.py b/python/selfie-lib/selfie_lib/SnapshotSystem.py index c20a6460e..17b27d776 100644 --- a/python/selfie-lib/selfie_lib/SnapshotSystem.py +++ b/python/selfie-lib/selfie_lib/SnapshotSystem.py @@ -126,7 +126,7 @@ def msg_snapshot_not_found_no_such_file(self, file) -> str: def msg_snapshot_mismatch(self, expected: str, actual: str) -> str: # noqa: ARG002 return self.msg( - "Snapshot mismatch (error msg could be better https://github.com/diffplug/selfie/issues/501)" + "Snapshot mismatch (error msg could be better https://github.com/diffplug/selfie-lib/issues/501)" ) def msg_snapshot_mismatch_binary(self, expected: bytes, actual: bytes) -> str: diff --git a/python/selfie-lib/selfie_lib/SourceFile.py b/python/selfie-lib/selfie_lib/SourceFile.py index 24962b028..961bb6ee2 100644 --- a/python/selfie-lib/selfie_lib/SourceFile.py +++ b/python/selfie-lib/selfie_lib/SourceFile.py @@ -90,7 +90,7 @@ def set_literal_and_get_newline_delta(self, literal_value: LiteralValue) -> int: f"There is an error in {literal_value.format.__class__.__name__}, " "the following value isn't round tripping.\n" f"Please report this error and the data below at " - "https://github.com/diffplug/selfie/issues/new\n" + "https://github.com/diffplug/selfie-lib/issues/new\n" f"```\n" f"ORIGINAL\n{literal_value.actual}\n" f"ROUNDTRIPPED\n{round_tripped}\n" diff --git a/python/selfie-lib/selfie_lib/WriteTracker.py b/python/selfie-lib/selfie_lib/WriteTracker.py index 8158dc89d..dd62f8f16 100644 --- a/python/selfie-lib/selfie_lib/WriteTracker.py +++ b/python/selfie-lib/selfie_lib/WriteTracker.py @@ -192,11 +192,11 @@ def record( ).parse_literal(snapshot.format) except Exception as e: raise AssertionError( - f"Error while parsing the literal at {call.location.ide_link(layout)}. Please report this error at https://github.com/diffplug/selfie" + f"Error while parsing the literal at {call.location.ide_link(layout)}. Please report this error at https://github.com/diffplug/selfie-lib" ) from e if parsed_value != snapshot.expected: raise layout.fs.assert_failed( - f"Selfie cannot modify the literal at {call.location.ide_link(layout)} because Selfie has a parsing bug. Please report this error at https://github.com/diffplug/selfie", + f"Selfie cannot modify the literal at {call.location.ide_link(layout)} because Selfie has a parsing bug. Please report this error at https://github.com/diffplug/selfie-lib", snapshot.expected, parsed_value, ) diff --git a/selfie.dev/README.md b/selfie.dev/README.md index 694710114..49da43478 100644 --- a/selfie.dev/README.md +++ b/selfie.dev/README.md @@ -1,4 +1,4 @@ -This page gets built with `npm run build` and deployed to [https://selfie.dev](https://selfie.dev) via CloudFlare, which is deploying the `release` branch. A preview will be generated for `selfie.dev/*` branches. +This page gets built with `npm run build` and deployed to [https://lib.selfie.dev](https://lib.selfie.dev) via CloudFlare, which is deploying the `release` branch. A preview will be generated for `selfie.dev/*` branches. To develop locally, run `npm run dev` and you'll get a local dev server with hotreload. diff --git a/selfie.dev/next-env.d.ts b/selfie.dev/next-env.d.ts index a4a7b3f5c..254b73c16 100644 --- a/selfie.dev/next-env.d.ts +++ b/selfie.dev/next-env.d.ts @@ -1,5 +1,6 @@ /// /// +/// // NOTE: This file should not be edited -// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information. +// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information. diff --git a/selfie.dev/public/_redirects b/selfie.dev/public/_redirects index 3dc8dcbcb..927ce55df 100644 --- a/selfie.dev/public/_redirects +++ b/selfie.dev/public/_redirects @@ -1,7 +1,7 @@ /jvm/advanced /jvm/facets 301 -/js https://github.com/diffplug/selfie/issues/84 -/js/* https://github.com/diffplug/selfie/issues/84 -/go https://github.com/diffplug/selfie/issues/85 -/go/* https://github.com/diffplug/selfie/issues/85 -/other-platforms https://github.com/diffplug/selfie/issues/85 -/other-platforms/* https://github.com/diffplug/selfie/issues/85 \ No newline at end of file +/js https://github.com/diffplug/selfie-lib/issues/84 +/js/* https://github.com/diffplug/selfie-lib/issues/84 +/go https://github.com/diffplug/selfie-lib/issues/85 +/go/* https://github.com/diffplug/selfie-lib/issues/85 +/other-platforms https://github.com/diffplug/selfie-lib/issues/85 +/other-platforms/* https://github.com/diffplug/selfie-lib/issues/85 \ No newline at end of file diff --git a/selfie.dev/public/robots.txt b/selfie.dev/public/robots.txt index a07ee939a..cd5b90881 100644 --- a/selfie.dev/public/robots.txt +++ b/selfie.dev/public/robots.txt @@ -1,4 +1,4 @@ -Sitemap: https://selfie.dev/sitemap.xml +Sitemap: https://lib.selfie.dev/sitemap.xml User-agent: * Disallow: /demo-gif \ No newline at end of file diff --git a/selfie.dev/public/sitemap.xml b/selfie.dev/public/sitemap.xml index a97972935..c4a20c25a 100644 --- a/selfie.dev/public/sitemap.xml +++ b/selfie.dev/public/sitemap.xml @@ -1,23 +1,23 @@ - https://selfie.dev/jvm + https://lib.selfie.dev/jvm 2024-02-19 - https://selfie.dev/jvm/get-started + https://lib.selfie.dev/jvm/get-started 2024-02-19 - https://selfie.dev/jvm/kotest + https://lib.selfie.dev/jvm/kotest 2024-02-19 - https://selfie.dev/jvm/facets + https://lib.selfie.dev/jvm/facets 2024-02-19 - https://selfie.dev/jvm/cache + https://lib.selfie.dev/jvm/cache 2024-02-19 \ No newline at end of file diff --git a/selfie.dev/src/components/ButtonList.tsx b/selfie.dev/src/components/ButtonList.tsx index 663174378..986dce89d 100644 --- a/selfie.dev/src/components/ButtonList.tsx +++ b/selfie.dev/src/components/ButtonList.tsx @@ -39,26 +39,6 @@ export function ButtonList() { jvm - - - - - - ); } diff --git a/selfie.dev/src/components/DocsImage.tsx b/selfie.dev/src/components/DocsImage.tsx index 8456b925a..c15887e82 100644 --- a/selfie.dev/src/components/DocsImage.tsx +++ b/selfie.dev/src/components/DocsImage.tsx @@ -1,6 +1,6 @@ import clsx from "clsx/lite"; -const BASE_URL = "https://selfie.dev"; +const BASE_URL = "https://lib.selfie.dev"; interface DocsImageProps { imgAbsoluteUrl: string; diff --git a/selfie.dev/src/components/HeroDemoGif.tsx b/selfie.dev/src/components/HeroDemoGif.tsx index c5b8ceccf..a76f87769 100644 --- a/selfie.dev/src/components/HeroDemoGif.tsx +++ b/selfie.dev/src/components/HeroDemoGif.tsx @@ -78,12 +78,6 @@ export function ButtonList() { {" "} - {" "} - - - {" "} - - ); diff --git a/selfie.dev/src/components/Navigation/Navigation.tsx b/selfie.dev/src/components/Navigation/Navigation.tsx index 279627f9a..3207cb260 100644 --- a/selfie.dev/src/components/Navigation/Navigation.tsx +++ b/selfie.dev/src/components/Navigation/Navigation.tsx @@ -41,9 +41,7 @@ export function Navigation() { setSelectIsOpen={setSelectIsOpen} handleChange={handleChange} /> - {pathParts.language !== "other-platforms" && ( - - )} + )} diff --git a/selfie.dev/src/components/Navigation/SubNavigation.tsx b/selfie.dev/src/components/Navigation/SubNavigation.tsx index 36d2298b2..6ae41cd85 100644 --- a/selfie.dev/src/components/Navigation/SubNavigation.tsx +++ b/selfie.dev/src/components/Navigation/SubNavigation.tsx @@ -79,7 +79,7 @@ export function SubNavigation({ pathParts, selectIsOpen }: SubNavigationProps) { ); })} - +