Skip to content

Commit

Permalink
Merge branch 'main' into 1.17.6
Browse files Browse the repository at this point in the history
* 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
  ...
  • Loading branch information
JustasL committed Dec 11, 2024
2 parents 45d14a4 + 42a0861 commit feb790c
Show file tree
Hide file tree
Showing 49 changed files with 1,967 additions and 422 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ jobs:
strategy:
matrix:
xcode:
- "14.3.1"
- 15.4
- '16.0'

name: macOS 13 (Xcode ${{ matrix.xcode }})
runs-on: macos-13
name: macOS
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- name: Select Xcode ${{ matrix.xcode }}
Expand Down
6 changes: 3 additions & 3 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"location" : "https://github.com/swiftlang/swift-syntax",
"state" : {
"revision" : "08a2f0a9a30e0f705f79c9cfaca1f68b71bdc775",
"version" : "510.0.0"
"revision" : "4c6cc0a3b9e8f14b3ae2307c5ccae4de6167ac2c",
"version" : "600.0.0-prerelease-2024-06-12"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/apple/swift-syntax", "508.0.1"..<"511.0.0")
.package(url: "https://github.com/swiftlang/swift-syntax", "509.0.0"..<"601.0.0-prerelease")
],
targets: [
.target(
Expand Down
32 changes: 22 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,28 @@ Repeat test runs will load this reference and compare it with the runtime value.
match, the test will fail and describe the difference. Failures can be inspected from Xcode's Report
Navigator or by inspecting the file URLs of the failure.

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

``` swift
assertSnapshot(of: vc, as: .image, record: true)

// or globally
```swift
// Record just this one snapshot
assertSnapshot(of: vc, as: .image, record: .all)

// Record all snapshots in a scope:
withSnapshotTesting(record: .all) {
assertSnapshot(of: vc1, as: .image)
assertSnapshot(of: vc2, as: .image)
assertSnapshot(of: vc3, as: .image)
}

isRecording = true
assertSnapshot(of: vc, as: .image)
// Record all snapshots in an XCTestCase subclass:
class FeatureTests: XCTestCase {
override func invokeTest() {
withSnapshotTesting(record: .all) {
super.invokeTest()
}
}
}
```

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

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

0 comments on commit feb790c

Please sign in to comment.