-
Notifications
You must be signed in to change notification settings - Fork 18
SwiftCurrent Intermediate Representation Generator #186
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
Merged
MattFreiburgAsynchrony
merged 166 commits into
data-driven
from
swiftcurrent-ir-generator
Mar 25, 2022
Merged
Changes from all commits
Commits
Show all changes
166 commits
Select commit
Hold shift + click to select a range
ebc902f
[launch-with-workflow] - Added FlowRepresentableMetadataTests, made F…
morganzellers 21a62c8
[launch-with-workflow] - Added tests for new launcher initializer usi…
morganzellers 41474c3
Adding support for .last computed property to AnyWorkflow
morganzellers e5b0e64
Adds support for workflows with more than one item.
morganzellers b3c2c6b
Refactor of ExtendedFlowRepresentableMetadata inits and function to f…
morganzellers 402a9fe
Added test for fatalError scenario in which no items in a workflow
morganzellers e67d734
WIP - Working through the tests and adding thenProceeds as I figure i…
morganzellers 3e70c53
WIP still - added more thenProceeds but still have a lot to drive out.
morganzellers 686cf28
Adds support for launching a workflow using an AnyWorkflow with start…
morganzellers 1d51a0a
Added generic constraint test file for AnyWorkflow launched Workflows.
morganzellers 4000010
WIP - Using generic constraints tests to drive out more thenProceeds.
morganzellers 3a2a9c4
[launch-with-workflow] - Adding missing init that was causing tests t…
Richard-Gist f87bbe7
[launch-with-workflow] - Fixing linting error - RAG
Richard-Gist d9e7845
[launch-with-workflow] - Fixed some linting and got some tests passin…
Richard-Gist 9c786ca
Merge branch 'data-driven' into launch-with-workflow
morganzellers f585656
[launch-with-workflow] - Removed tests for thenProceed functions only…
morganzellers ff16c99
[launch-with-workflow] - Adding more descriptive docs - RAG MZ
morganzellers 1f62b9b
[launch-with-workflow] - Added TODO to make public Workflow inits pri…
morganzellers 9a283fd
Taking Richard's whitespace fix
morganzellers d5739d2
[launch-with-workflow] - Adds WorkflowLauncher initializer for starti…
morganzellers de9fe1c
Merge pull request #150 from wwt/launch-with-workflow
Richard-Gist 1d430cb
Merge branch 'launch-with-workflow' into data-driven
morganzellers 7d5acb3
[skip ci] data-spike4 - This spike takes the registry a bit farther t…
Richard-Gist 540ebb5
Spiked out a script to parse output from SourceKitten's structure call.
morganzellers c3c7533
Added getSwiftFiles function to list all swift files in a passed dire…
morganzellers 282d43e
Added multi-calls to sourcekitten.
morganzellers 73ec1e1
WIP - Parsing json dictionary directly
morganzellers 5b8e4e7
Cleaning up script and supporting input type
morganzellers 0b1c595
Beginning switch to swift-syntax for parsing. Added script to Example…
morganzellers 50f7ddf
Everything compiles now
morganzellers aa1c707
Added script to copy executable to ExampleApps folder, script running
morganzellers b62b6e5
Script working with swift-syntax example code.
morganzellers c006f4a
Finding some keywords.
morganzellers c1fbdde
Finding Test FR's - trying views
morganzellers b282b52
Finding non-test structs that conform to FlowRepresentable
morganzellers 866ca10
Removing old sourcekitten code.
morganzellers 0f429a0
Cleaning up more SourceKitten things
morganzellers 32b3531
[metadata-describer] - Created protocol FlowRepresentableMetadataDesc…
Richard-Gist 3e0713d
More flexibly checking for FR conformance.
morganzellers 0f4edbe
[skip ci] metadata-describer - This has tests to showcase/test extend…
Richard-Gist 0de4d7f
Added more flexible checking for FR conformance.
morganzellers 182c2ee
[metadata-describer] - FR no longer explicitly conforms to FRMD. Test…
Richard-Gist 13231df
[metadata-describer] - Renamed createMetadata to metadataFactory
Richard-Gist c616849
Handling class conformance better.
morganzellers 37953f6
Restricting FR extension to where Self is FlowRepresentableMetadataDe…
Richard-Gist cab7328
Added rough support for finding conformance to FlowRepresentable via …
morganzellers 2027ff1
[metadata-describer] - Adding tests to cover flowPersistence defaults…
Richard-Gist af03190
[metadata-describer] - Updating test to show what is possible - RAG
Richard-Gist 37d9047
[metadata-describer] - minor refactor to Describer - RAG
Richard-Gist 03a6ee9
[metadata-describer] - Added Default implementation for metadataFacto…
Richard-Gist 1749114
[metadata-describer] - Minor refactor to default flowPersistence in E…
Richard-Gist 0f3d4a3
Added more flexible checking for protocol and extensions.
morganzellers 55d5055
[metadata-describer] - Fixed some documentation and fixed bug with Sw…
Richard-Gist 908871a
[metadata-describer] - updating headers - RAG
Richard-Gist 30a86ba
Using FileVisitor class to spike out approach with that style of addi…
morganzellers 2f57d76
Cleaning things up from previous approach
morganzellers aa32a18
Gets things to parity with previous branch in a non-efficient way
morganzellers cca34ea
Merge pull request #155 from wwt/metadata-describer
morganzellers bd35d4e
[data-drive-json-consumption] - renamed FlowRepresentableMetadataDesc…
Tyler-Keith-Thompson 02b4ce8
[data-drive-json-consumption] - There is now a failing test! We are a…
Tyler-Keith-Thompson 2bfc907
[data-drive-json-consumption] - Hmm, funny how a little infinite recu…
Tyler-Keith-Thompson 89d63b7
[data-drive-json-consumption] - We now reasonably decode AnyWorkflows…
Tyler-Keith-Thompson 635fbce
[data-drive-json-consumption] - Minor refactors and added an addition…
Tyler-Keith-Thompson 857b826
[data-drive-json-consumption] - Code that was temporarily added to su…
Tyler-Keith-Thompson 272c3eb
[data-drive-json-consumption] - After reflection, extending JSON for …
Tyler-Keith-Thompson 2f2d1ef
[data-drive-json-consumption] - Refactor to dedup decoding logic - TT
Tyler-Keith-Thompson 4a234a5
[data-drive-json-consumption] - Removed todo for extending each FR si…
Tyler-Keith-Thompson 7085f54
[data-drive-json-consumption] - Updated WorkflowJSONSpec access level…
Tyler-Keith-Thompson 72a39e4
[data-drive-json-consumption] - Updated docs to satisfy Richard's ped…
Tyler-Keith-Thompson a8f668e
[data-driven-json-launch-persistence-styles] - Added a failing test f…
Tyler-Keith-Thompson 849d880
[data-driven-json-launch-persistence-styles] - Updated tests to use t…
Tyler-Keith-Thompson 1db2ce0
[data-driven-json-launch-persistence-styles] - SwiftUI now decodes la…
Tyler-Keith-Thompson a623c18
[data-driven-json-launch-persistence-styles] - Launch styles are now …
Tyler-Keith-Thompson 48538a1
[data-driven-json-launch-persistence-styles] - All the tests pass! ..…
Tyler-Keith-Thompson 1ba2e26
[data-driven-json-launch-persistence-styles] - Updated some missing d…
Tyler-Keith-Thompson b140c34
[data-driven-json-launch-persistence-styles] - Fixed deprecation warn…
Tyler-Keith-Thompson 73c410a
[data-driven-json-launch-persistence-styles] - Added an additional te…
Tyler-Keith-Thompson d8427bc
[data-driven-json-launch-persistence-styles] - Fixed cocoapods lib li…
Tyler-Keith-Thompson 16456e3
Merge pull request #161 from wwt/data-drive-json-consumption
morganzellers dfa5341
Merge pull request #163 from wwt/data-driven-json-launch-persistence-…
morganzellers 1174be0
Resolving conflicts.
morganzellers 98ce064
LoginView for testing FR approach. Updating to new types next.
morganzellers 3d1682e
Updated for new types - next up is finding the flowRepresentableName …
morganzellers 1bc09d8
WIP
morganzellers c4e54b0
[data-driven-extendable-json] - Starting the process of decoding more…
683d313
[data-driven-extendable-json] - Testing that code should throw if flo…
60a7d50
[data-driven-extendable-json] - Tested that decoder throws when Launc…
c37811a
[data-driven-extendable-json] - Reducing decoder duplication with Pla…
ccc12d1
[data-driven-extendable-json] - Remove whitespace to fix linting erro…
6b150e5
[data-driven-extendable-json] - Adds multiplatform tests for data dri…
1bf9018
[data-driven-extendable-json] - Working on adding Fastlane for platfo…
748ccd4
[data-driven-extendable-json] - Updated PR_CI to try and run the plat…
Tyler-Keith-Thompson 67c5bd0
[data-driven-extendable-json] - Just comment out tests for now and ru…
Tyler-Keith-Thompson 8e81cfc
[data-driven-extendable-json] - Added the scheme to the workspace - TT
Tyler-Keith-Thompson 796e17b
[data-driven-extendable-json] - Added back all the schemes that someh…
Tyler-Keith-Thompson 3cc805d
[data-driven-extendable-json] - Ahha, it was a copy pasta error. When…
Tyler-Keith-Thompson d8e255b
[data-driven-extendable-json] - Whoops, workspace was in a different …
Tyler-Keith-Thompson 162e9ee
[data-driven-extendable-json] - Execute multiplatform tests in parall…
Tyler-Keith-Thompson bb5d59a
[data-driven-extendable-json] - Added multiplatform tests to the Swif…
Tyler-Keith-Thompson 32b7151
[data-driven-extendable-json] - Minor refactor to make PlatformDecoda…
Tyler-Keith-Thompson 1ea7d4b
[data-driven-extendable-json] - VERY necessary whitespace fix - TT
Tyler-Keith-Thompson 4e8f628
[data-driven-extendable-json] - The availability check lied to me loc…
Tyler-Keith-Thompson c16c9bd
Merge branch 'main' into data-driven
Tyler-Keith-Thompson 41c1f06
Merge branch 'data-driven' into data-driven-extendable-json
Tyler-Keith-Thompson f0566d8
Merge pull request #170 from wwt/data-driven-extendable-json
morganzellers eeb395c
Preparations to separate finding conformance from printing results.
morganzellers c1fea76
Making things more modular.
morganzellers 7a1374a
Removed old print. Added check for protocols. Next finding parent.
morganzellers 8cb1b97
Handles embedded types in a more thorough way although roughly.
morganzellers 3693dd1
Refactored loops to be easier to read.
morganzellers e43ba37
Beginning of handling parents.
morganzellers 98ee35b
Finding parents
morganzellers 57a1a8b
Committing write to file function.
morganzellers 9ed1ec4
Adds support for checking for subtypes.
morganzellers 5219e37
Cleaning up to prep for writing to a file.
morganzellers ed50545
Trying to sort out the Codable conformance to make writing to file mo…
morganzellers d333189
Writing output to file as JSON encoded dictionaries.
morganzellers 940b5c2
[skip ci] data-spike-sitrep - Moved files into a package - TT
Tyler-Keith-Thompson 5af14ef
[data-spike-sitrep] - Refactored to use ArgumentParser and stdout - TT
Tyler-Keith-Thompson 453dd70
[data-spike-sitrep] - Tests added! That was not easy - TT
Tyler-Keith-Thompson fecedca
[data-spike-sitrep] - Alright, tests were added, things seem reasonab…
Tyler-Keith-Thompson 87611fa
[data-spike-sitrep] - Satisfied some tests, wrote some more that are …
Tyler-Keith-Thompson a97a213
[data-spike-sitrep] - Refactored a bit, things ended up both more rea…
Tyler-Keith-Thompson 76d3f81
Cleaning up.
morganzellers 360a5d1
Cleaning up some things in order to ready for contributions and a PR.
morganzellers fb8ca00
Removing things from data-spike4 branch that I missed. If we need the…
morganzellers aa2b1f5
Green CI Please.
morganzellers c12938e
[swiftcurrent-ir-generator] - Added linting to generator scheme - TT
Tyler-Keith-Thompson 9a6f25e
Adds code to pass tests around single layer of nesting as well as mul…
morganzellers 11897cc
Finds conformance nested 3 layers deep in a type. Fixes test testMult…
morganzellers 713c33a
Paring down some things - bit more to go.
morganzellers 6b082cc
Merge branch 'data-driven' into swiftcurrent-ir-generator
morganzellers dc0a149
[swiftcurrent-ir-generator] - Allowed for arbitrarily deep type nesti…
Tyler-Keith-Thompson 111d48b
[swiftcurrent-ir-generator] - Refactored out that inout thing - TT
Tyler-Keith-Thompson d1c8e27
[swiftcurrent-ir-generator] - Arbitrarily deep protocol chains now wo…
Tyler-Keith-Thompson 724c646
[swiftcurrent-ir-generator] - As long as you are not afraid of flatma…
Tyler-Keith-Thompson 19fb247
[swiftcurrent-ir-generator] - Quick comment to help people understand…
Tyler-Keith-Thompson a7179f6
[swiftcurrent-ir-generator] - Some other minor refactors - TT
Tyler-Keith-Thompson f81f0d2
[swiftcurrent-ir-generator] - Reduced complexity a bit by getting rid…
Tyler-Keith-Thompson 9294c9d
[swiftcurrent-ir-generator] - Some more minor refactors - TT
Tyler-Keith-Thompson 9218be5
[swiftcurrent-ir-generator] - Lots of dead code cleanup and renaming …
Tyler-Keith-Thompson 88f3bd2
[swiftcurrent-ir-generator] - A little more dead code removal - TT
Tyler-Keith-Thompson aa012e0
[swiftcurrent-ir-generator] - Alright, I think this finishes up the i…
Tyler-Keith-Thompson 4622d55
[swiftcurrent-ir-generator] - Let's try to run all the tests using fa…
Tyler-Keith-Thompson 8fd770e
[swiftcurrent-ir-generator] - Sundell wrote a thing to use the shell,…
Tyler-Keith-Thompson 2249bd7
[swiftcurrent-ir-generator] - Minor update to testing strategy with f…
Tyler-Keith-Thompson cf257b7
[swiftcurrent-ir-generator] - Minor tweak to the help on the CLI util…
Tyler-Keith-Thompson 34c7479
[swiftcurrent-ir-generator] - Lower deployment target for the pipelin…
Tyler-Keith-Thompson 758043a
Merge branch 'data-driven' into swiftcurrent-ir-generator
Tyler-Keith-Thompson 06e1f84
[swiftcurrent-ir-generator] - Tried adding match to help out, there's…
Tyler-Keith-Thompson c4f5c4b
[swiftcurrent-ir-generator] - Moved and updated matchfile - TT
Tyler-Keith-Thompson 2d31664
Merge branch 'swiftcurrent-ir-generator' of github.com:wwt/SwiftCurre…
Tyler-Keith-Thompson 81ac9f5
[swiftcurrent-ir-generator] - Add git url to match in fastlane - TT
Tyler-Keith-Thompson 617418e
[swiftcurrent-ir-generator] - Weirdly need http and PAT for this - TT
Tyler-Keith-Thompson 7555ff6
[swiftcurrent-ir-generator] - Think secrets are not environment vars …
Tyler-Keith-Thompson e4ab5dd
[swiftcurrent-ir-generator] - Following recommendation from somebody …
Tyler-Keith-Thompson e779650
[swiftcurrent-ir-generator] - More attempts to get match working - TT
Tyler-Keith-Thompson 52b7bc7
[swiftcurrent-ir-generator] - Whoops, had an issue with my workflow f…
Tyler-Keith-Thompson 43e6f77
[swiftcurrent-ir-generator] - Remove superfluous name - TT
Tyler-Keith-Thompson d5f6823
[swiftcurrent-ir-generator] - Had some cruft from a template - TT
Tyler-Keith-Thompson e70ad98
[swiftcurrent-ir-generator] - Perhaps setup_ci is not needed? - TT
Tyler-Keith-Thompson c31ab3b
[swiftcurrent-ir-generator] - Switch to ssh - TT
Tyler-Keith-Thompson 6c31292
[swiftcurrent-ir-generator] - setup_ci does some nice keychain things…
Tyler-Keith-Thompson 30eed3a
[swiftcurrent-ir-generator] - Needed to trigger CI again - TT
Tyler-Keith-Thompson 04a3866
[swiftcurrent-ir-generator] - Sadly, lower ArgumentParser version for…
Tyler-Keith-Thompson ef4d36c
[swiftcurrent-ir-generator] - Silent failures are bad, therefore let'…
Tyler-Keith-Thompson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| git_url("git@github.com:wwt/swiftcurrent-ios-certs-and-profiles.git") | ||
|
|
||
| storage_mode("git") | ||
|
|
||
| type("development") # The default type, can be: appstore, adhoc, enterprise or development | ||
|
|
||
| app_identifier(["WWT.SwiftCurrent-IRGeneratorTests"]) | ||
|
|
||
| # The docs are available on https://docs.fastlane.tools/actions/match |
235 changes: 235 additions & 0 deletions
235
.github/SwiftCurrentLint/SwiftCurrent-IRGeneratorTests/SwiftCurrent_IRGeneratorTests.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,235 @@ | ||
| // | ||
| // SwiftCurrent_IRGeneratorTests.swift | ||
| // SwiftCurrent | ||
| // | ||
| // Created by Tyler Thompson on 3/3/22. | ||
| // Copyright © 2022 WWT and Tyler Thompson. All rights reserved. | ||
| // | ||
|
|
||
| import Foundation | ||
| import ShellOut | ||
| import XCTest | ||
|
|
||
| class SwiftCurrent_IRGeneratorTests: XCTestCase { | ||
| static var packageSwiftDirectory: URL = { | ||
| // ../../../ brings you to SwiftCurrent directory | ||
| URL(fileURLWithPath: #file).deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent() | ||
| }() | ||
|
|
||
| lazy var generatorCommand: String = { | ||
| "\(Self.packageSwiftDirectory.path)/.build/*/debug/SwiftCurrent_IRGenerator" | ||
| }() | ||
|
|
||
| override class func setUp() { | ||
| XCTAssertNoThrow(try shellOut(to: "rm -rf \(Self.packageSwiftDirectory.path)/.build/*/debug")) | ||
| XCTAssert(try shellOut(to: "cd \(Self.packageSwiftDirectory.path) && swift build --product=SwiftCurrent_IRGenerator").contains("Build complete!")) | ||
| } | ||
|
|
||
| func testSingleDecodableStruct() throws { | ||
| let source = """ | ||
| struct Foo: WorkflowDecodable { } | ||
| """ | ||
|
|
||
| let output = try shellOut(to: "\(generatorCommand) \"\(source)\"") | ||
| let IR = try JSONDecoder().decode([IRType].self, from: XCTUnwrap(output.data(using: .utf8))) | ||
|
|
||
| XCTAssertEqual(IR.count, 1) | ||
| XCTAssertEqual(IR.first?.name, "Foo") | ||
| } | ||
|
|
||
| func testSingleDecodableClass() throws { | ||
| let source = """ | ||
| class Foo: WorkflowDecodable { } | ||
| """ | ||
|
|
||
| let output = try shellOut(to: "\(generatorCommand) \"\(source)\"") | ||
| let IR = try JSONDecoder().decode([IRType].self, from: XCTUnwrap(output.data(using: .utf8))) | ||
|
|
||
| XCTAssertEqual(IR.count, 1) | ||
| XCTAssertEqual(IR.first?.name, "Foo") | ||
| } | ||
|
|
||
| func testMultipleMixedStructsAndClasses() throws { | ||
| let source = """ | ||
| class Foo: WorkflowDecodable { } | ||
| struct Bar: WorkflowDecodable { } | ||
| """ | ||
|
|
||
| let output = try shellOut(to: "\(generatorCommand) \"\(source)\"") | ||
| let IR = try JSONDecoder().decode([IRType].self, from: XCTUnwrap(output.data(using: .utf8))) | ||
| .sorted { $0.name < $1.name } | ||
|
|
||
| XCTAssertEqual(IR.count, 2) | ||
| XCTAssertEqual(IR.first?.name, "Bar") | ||
| XCTAssertEqual(IR.last?.name, "Foo") | ||
| } | ||
|
|
||
| func testOnlyDetectWorkflowDecodableTypes() throws { | ||
| let source = """ | ||
| struct Foo: WorkflowDecodable { } | ||
| struct Bar { } | ||
| """ | ||
|
|
||
| let output = try shellOut(to: "\(generatorCommand) \"\(source)\"") | ||
| let IR = try JSONDecoder().decode([IRType].self, from: XCTUnwrap(output.data(using: .utf8))) | ||
|
|
||
| XCTAssertEqual(IR.count, 1) | ||
| XCTAssertEqual(IR.first?.name, "Foo") | ||
| } | ||
|
|
||
| func testSingleLayerOfIndirection() throws { | ||
| let source = """ | ||
| protocol Foo: WorkflowDecodable { } | ||
| struct Bar: Foo { } | ||
| """ | ||
|
|
||
| let output = try shellOut(to: "\(generatorCommand) \"\(source)\"") | ||
| let IR = try JSONDecoder().decode([IRType].self, from: XCTUnwrap(output.data(using: .utf8))) | ||
|
|
||
| XCTAssertEqual(IR.count, 1) | ||
| XCTAssertEqual(IR.first?.name, "Bar") | ||
| } | ||
|
|
||
| func testMultipleLayersOfIndirection() throws { | ||
| let source = """ | ||
| protocol Foo: WorkflowDecodable { } | ||
| protocol Bar: Foo { } | ||
| struct Baz: Bar { } | ||
| """ | ||
|
|
||
| let output = try shellOut(to: "\(generatorCommand) \"\(source)\"") | ||
| let IR = try JSONDecoder().decode([IRType].self, from: XCTUnwrap(output.data(using: .utf8))) | ||
|
|
||
| XCTAssertEqual(IR.count, 1) | ||
| XCTAssertEqual(IR.first?.name, "Baz") | ||
| } | ||
|
|
||
| func testTonsOfLayersOfIndirection() throws { | ||
| let source = """ | ||
| protocol Foo: WorkflowDecodable { } | ||
| protocol Bar: Foo { } | ||
| protocol Bat: Bar { } | ||
| struct Baz: Bat { } | ||
| """ | ||
|
|
||
| let output = try shellOut(to: "\(generatorCommand) \"\(source)\"") | ||
| let IR = try JSONDecoder().decode([IRType].self, from: XCTUnwrap(output.data(using: .utf8))) | ||
|
|
||
| XCTAssertEqual(IR.count, 1) | ||
| XCTAssertEqual(IR.first?.name, "Baz") | ||
| } | ||
|
|
||
| func testSingleLayerOfNesting() throws { | ||
| let source = """ | ||
| enum Foo { | ||
| struct Bar: WorkflowDecodable { } | ||
| } | ||
| """ | ||
|
|
||
| let output = try shellOut(to: "\(generatorCommand) \"\(source)\"") | ||
| let IR = try JSONDecoder().decode([IRType].self, from: XCTUnwrap(output.data(using: .utf8))) | ||
|
|
||
| XCTAssertEqual(IR.count, 1) | ||
| XCTAssertEqual(IR.first?.name, "Foo.Bar") | ||
| } | ||
|
|
||
| func testMultipleLayersOfNesting() throws { | ||
| let source = """ | ||
| enum Foo { | ||
| struct Bar { | ||
| class Baz: WorkflowDecodable { } | ||
| } | ||
| } | ||
| """ | ||
|
|
||
| let output = try shellOut(to: "\(generatorCommand) \"\(source)\"") | ||
| let IR = try JSONDecoder().decode([IRType].self, from: XCTUnwrap(output.data(using: .utf8))) | ||
|
|
||
| XCTAssertEqual(IR.count, 1) | ||
| XCTAssertEqual(IR.first?.name, "Foo.Bar.Baz") | ||
| } | ||
|
|
||
| func testTonsOfLayersOfNesting() throws { | ||
| let source = """ | ||
| enum Foo { | ||
| struct Bar { | ||
| class Baz { | ||
| struct Bat: WorkflowDecodable { } | ||
| } | ||
| } | ||
| } | ||
| """ | ||
|
|
||
| let output = try shellOut(to: "\(generatorCommand) \"\(source)\"") | ||
| let IR = try JSONDecoder().decode([IRType].self, from: XCTUnwrap(output.data(using: .utf8))) | ||
|
|
||
| XCTAssertEqual(IR.count, 1) | ||
| XCTAssertEqual(IR.first?.name, "Foo.Bar.Baz.Bat") | ||
| } | ||
|
|
||
| func testConformanceViaExtension() throws { | ||
| let source = """ | ||
| struct Foo { } | ||
|
|
||
| extension Foo: WorkflowDecodable { } | ||
| """ | ||
|
|
||
| let output = try shellOut(to: "\(generatorCommand) \"\(source)\"") | ||
| let IR = try JSONDecoder().decode([IRType].self, from: XCTUnwrap(output.data(using: .utf8))) | ||
|
|
||
| XCTAssertEqual(IR.count, 1) | ||
| XCTAssertEqual(IR.first?.name, "Foo") | ||
| } | ||
|
|
||
| func testConformanceViaExtension_WithNesting() throws { | ||
| let source = """ | ||
| enum Foo { | ||
| struct Bar { } | ||
| } | ||
|
|
||
| extension Foo.Bar: WorkflowDecodable { } | ||
| """ | ||
|
|
||
| let output = try shellOut(to: "\(generatorCommand) \"\(source)\"") | ||
| let IR = try JSONDecoder().decode([IRType].self, from: XCTUnwrap(output.data(using: .utf8))) | ||
|
|
||
| XCTAssertEqual(IR.count, 1) | ||
| XCTAssertEqual(IR.first?.name, "Foo.Bar") | ||
| } | ||
|
|
||
| func testPerformance_WithASingleType() throws { | ||
| let source = """ | ||
| struct Foo: WorkflowDecodable { } | ||
| """ | ||
| measure { | ||
| _ = try? shellOut(to: "\(generatorCommand) \"\(source)\"") | ||
| } | ||
| } | ||
|
|
||
| func testPerformance_WithManyTypes() throws { | ||
| struct Structure { | ||
| let name: String | ||
| let type: String | ||
| } | ||
| func generateType() -> Structure { | ||
| let nominalType = ["struct", "enum", "class"].randomElement()! | ||
| let name: String = (Unicode.Scalar("A").value...Unicode.Scalar("Z").value) | ||
| .map(String.init(describing:)) | ||
| .filter { _ in Bool.random() } | ||
| .joined() | ||
| return Structure(name: name, type: nominalType) | ||
| } | ||
| let typeDefs = (1...1000).map { _ -> String in | ||
| let type = generateType() | ||
| return "\(type.type) \(type.name): WorkflowDecodable { }" | ||
| } | ||
| let source = typeDefs.joined() | ||
| measure { | ||
| _ = try? shellOut(to: "\(generatorCommand) \"\(source)\"") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| struct IRType: Decodable { | ||
| let name: String | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.