Skip to content

Commit feb790c

Browse files
committed
Merge branch 'main' into 1.17.6
* main: (27 commits) Run swift-format Fix assertSnapshot for Swift Testing tests. (pointfreeco#916) Add an NB to @_implementationOnly import. Run swift-format Import only the implementation of Testing. (pointfreeco#903) fix missing inline snapshot testing (pointfreeco#887) Feature/fixed decimal separator (pointfreeco#889) Run swift-format Xcode 16 beta 5: Fix snapshots test trait (pointfreeco#885) Run swift-format Don't invoke XCTContext when running in the Testing framework. (pointfreeco#884) Run swift-format Fixed .failed record mode in inline snapshots. (pointfreeco#874) Point updated packages to swiftlang organization (pointfreeco#873) Fix recordIssue for Xcode beta 3. (pointfreeco#869) Run swift-format Beta support for Swift Testing, and other improvements. (pointfreeco#867) Run swift-format New `canGenerateNewSnapshots` to avoid automatically creating missing ones in CI (pointfreeco#768) Run swift-format ...
2 parents 45d14a4 + 42a0861 commit feb790c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1967
-422
lines changed

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 2
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.github/workflows/ci.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ jobs:
1313
strategy:
1414
matrix:
1515
xcode:
16-
- "14.3.1"
16+
- 15.4
17+
- '16.0'
1718

18-
name: macOS 13 (Xcode ${{ matrix.xcode }})
19-
runs-on: macos-13
19+
name: macOS
20+
runs-on: macos-14
2021
steps:
2122
- uses: actions/checkout@v3
2223
- name: Select Xcode ${{ matrix.xcode }}

Package.resolved

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
{
44
"identity" : "swift-syntax",
55
"kind" : "remoteSourceControl",
6-
"location" : "https://github.com/apple/swift-syntax.git",
6+
"location" : "https://github.com/swiftlang/swift-syntax",
77
"state" : {
8-
"revision" : "08a2f0a9a30e0f705f79c9cfaca1f68b71bdc775",
9-
"version" : "510.0.0"
8+
"revision" : "4c6cc0a3b9e8f14b3ae2307c5ccae4de6167ac2c",
9+
"version" : "600.0.0-prerelease-2024-06-12"
1010
}
1111
}
1212
],

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ let package = Package(
2121
),
2222
],
2323
dependencies: [
24-
.package(url: "https://github.com/apple/swift-syntax", "508.0.1"..<"511.0.0")
24+
.package(url: "https://github.com/swiftlang/swift-syntax", "509.0.0"..<"601.0.0-prerelease")
2525
],
2626
targets: [
2727
.target(

README.md

+22-10
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,28 @@ Repeat test runs will load this reference and compare it with the runtime value.
3838
match, the test will fail and describe the difference. Failures can be inspected from Xcode's Report
3939
Navigator or by inspecting the file URLs of the failure.
4040

41-
You can record a new reference by setting the `record` parameter to `true` on the assertion or
42-
setting `isRecording` globally.
41+
You can record a new reference by customizing snapshots inline with the assertion, or using the
42+
`withSnapshotTesting` tool:
4343

44-
``` swift
45-
assertSnapshot(of: vc, as: .image, record: true)
46-
47-
// or globally
44+
```swift
45+
// Record just this one snapshot
46+
assertSnapshot(of: vc, as: .image, record: .all)
47+
48+
// Record all snapshots in a scope:
49+
withSnapshotTesting(record: .all) {
50+
assertSnapshot(of: vc1, as: .image)
51+
assertSnapshot(of: vc2, as: .image)
52+
assertSnapshot(of: vc3, as: .image)
53+
}
4854

49-
isRecording = true
50-
assertSnapshot(of: vc, as: .image)
55+
// Record all snapshots in an XCTestCase subclass:
56+
class FeatureTests: XCTestCase {
57+
override func invokeTest() {
58+
withSnapshotTesting(record: .all) {
59+
super.invokeTest()
60+
}
61+
}
62+
}
5163
```
5264

5365
## Snapshot Anything
@@ -210,9 +222,9 @@ targets: [
210222
- **`Codable` support**. Snapshot encodable data structures into their JSON and property list
211223
representations.
212224
- **Custom diff tool integration**. Configure failure messages to print diff commands for
213-
[Kaleidoscope](https://kaleidoscope.app) (or your diff tool of choice).
225+
[Kaleidoscope](https://kaleidoscope.app) or your diff tool of choice.
214226
``` swift
215-
SnapshotTesting.diffTool = "ksdiff"
227+
SnapshotTesting.diffToolCommand = { "ksdiff \($0) \($1)" }
216228
```
217229

218230
[available-strategies]: https://swiftpackageindex.com/pointfreeco/swift-snapshot-testing/main/documentation/snapshottesting/snapshotting

0 commit comments

Comments
 (0)