-
-
Notifications
You must be signed in to change notification settings - Fork 42
Update swift-syntax, fix Bool switch warnings, and improve test organization & coverage
#150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
db33503
a9b3f01
551c9a1
af382df
44558a5
6ca0d90
67ab745
37c080c
ea720d5
0b3f7dc
6da09a6
4a3190a
a405f1b
342f6ff
3873f76
2d44730
edeba0b
c1dd2be
b031947
aa9002e
bb8f9a5
e6e5a12
161b144
6cb6b70
2344087
fae5691
1f3e57c
4e57d33
3ffa20e
6ca3eea
c589543
4b6fe3d
201ce15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # This workflow will build a Swift project | ||
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift | ||
|
|
||
| name: Swift `build` & `test` | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| paths-ignore: | ||
| - '**/*.md' | ||
| pull_request: | ||
| paths-ignore: | ||
| - '**/*.md' | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| runs-on: macos-latest | ||
| timeout-minutes: 20 | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Show Swift version | ||
| run: swift --version | ||
|
|
||
| - name: Cache SwiftPM dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: .build | ||
| key: ${{ runner.os }}-swiftpm-${{ hashFiles('Package.resolved') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-swiftpm- | ||
| - name: Build | ||
| run: swift build --configuration debug | ||
|
|
||
| - name: Run tests | ||
| run: swift test --configuration debug --parallel --verbose | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,6 +59,7 @@ Package.resolved | |
| *.o | ||
| *.d | ||
| *.swiftdeps* | ||
| *.dia | ||
|
|
||
| # CocoaPods | ||
| # | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you explain what this file does? and why is it needed? |
||
| "default": true, | ||
| "MD012": false, | ||
| "MD013": false, | ||
| "MD024": { | ||
| "siblings_only": true | ||
| }, | ||
| "MD033": false, | ||
| "MD041": false, | ||
| "MD060": false | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| # MetaCodable | ||
|
|
||
| [](https://github.com/qizh/MetaCodable/actions/workflows/swift.yml) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. after removing the unnecessary workflow file this can be removed as well |
||
| [](https://swiftpackageindex.com/SwiftyLab/MetaCodable/documentation/metacodable) | ||
| [](https://badge.fury.io/gh/SwiftyLab%2FMetaCodable) | ||
| [](https://badge.fury.io/co/MetaCodable) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,15 +84,19 @@ package struct EnumVariable: TypeVariable, DeclaredVariable { | |
| let caseEncodeExpr: CaseCode = { name, variables in | ||
| let args = Self.encodingArgs(representing: variables) | ||
| let callee: ExprSyntax = ".\(name)" | ||
| let fExpr = | ||
| if !args.isEmpty { | ||
| FunctionCallExprSyntax(callee: callee) { args } | ||
| } else { | ||
| FunctionCallExprSyntax( | ||
| calledExpression: callee, leftParen: nil, rightParen: nil | ||
| ) {} | ||
| } | ||
| return ExprSyntax(fExpr) | ||
| if args.isEmpty { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason for this change? May be you can add some test cases that demonstrates what this fixes?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @soumyamahunt, I've updated the existing
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW I'd like to give names to Like the following: @Suite("Logical tests group")
struct SomeTestSuite {
@Test("Test Bool expansion")
func textBoolExpansion() async {
/// ...
}
}
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I am okay with having readable test suite and method names.
@qizh the tests you have mentioned here is for the changes you have done in
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @soumyamahunt Good catch — I clearly need more coffee when referencing tests. ☕ The test you're looking for is CodedAsMixedTypesTests.swift (added in commit
Previously existing indirect tests:
What the fix addresses: The fix checks if both Let me know if this clarifies things or if you'd like the tests restructured.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @qizh you are still describing the changes for |
||
| /// No associated values: return just the case name without parentheses | ||
| return callee | ||
| } else { | ||
| let fExpr = FunctionCallExprSyntax( | ||
| calledExpression: callee, | ||
| leftParen: .leftParenToken(), | ||
| arguments: args, | ||
| rightParen: .rightParenToken(), | ||
| trailingClosure: nil | ||
| ) | ||
| return ExprSyntax(fExpr) | ||
| } | ||
| } | ||
| self.init( | ||
| from: decl, in: context, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this, this repo already has CI that tests various configurations