-
Notifications
You must be signed in to change notification settings - Fork 143
Adapt tests to work better in Swift CI #45
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
Conversation
It may be good to run these tests a few times before merging. I'll run them once now to confirm that these changes work on the different platforms. |
@swift-ci please test |
fileManager: FileManager = .default | ||
) throws -> URL { | ||
let bundleParentDir = Bundle(for: Self.self).bundleURL.deletingLastPathComponent() | ||
let baseURL = bundleParentDir.appendingPathComponent(name.replacingWhitespaceAndPunctuation(with: "-")) |
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.
@gottesmm Does this look like a suitable base path for temp data in tests?
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.
@shahmishal what do you think?
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.
@shahmishal Does this base path look good or is there a better base path for temp data in tests on Swift CI?
|
||
// Test utility library | ||
.target( | ||
name: "SwiftDocCTestUtilities", |
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.
Right now this target is only used to share one file between the two test targets but there are more code that could be moved out of SwiftDocC itself into this test target instead.
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.
This is great! I've been wanting something like this for a while. No need to do it now- but eventually moving all of our test bundles over to this library would have a big impact on our repo size I think.
We should wait until #44 lands and have this PR update the new tests that were added in that PR. |
...wiftDocCUtilities/ArgumentParsing/ActionExtensions/ConvertAction+CommandInitialization.swift
Outdated
Show resolved
Hide resolved
|
||
public extension XCTestCase { | ||
|
||
@available(*, deprecated, message: "Use `createTemporaryDirectory` instead in unit tests to avoid referencing a shared location in Swift CI.") |
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.
What's blocking us from moving away from NSTemporaryDirectory
everywhere? I find it odd to mark an API as deprecated which still has usages within the repo, we're going to see deprecation warnings for those.
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.
This function only shadows calls made from within test cases. I've updated all of those, so this doesn't add any deprecation warnings.
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.
Can we do this for FileManager.default.temporaryDirectory as well? Not sure if Swift will allow that...
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.
No. I'm not aware of a way tp shadow a property on another type like that.
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.
I gave this a go- it looks like you can just redefine it but you need to define it in each test framework so that the compiler knows which overload to favor. (It uses an overload in the local module over one in the imported module.)
extension FileManager {
@available(*, deprecated, message: "Use `createTemporaryDirectory` instead in unit tests to avoid referencing a shared location in Swift CI.")
var temporaryDirectory: URL {
XCTFail("Use `createTemporaryDirectory` instead in unit tests to avoid referencing a shared location in Swift CI.")
return URL(fileURLWithPath: Foundation.NSTemporaryDirectory())
}
}
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.
I just added this in this branch and actually found a couple uses:
/swift-docc/Tests/SwiftDocCUtilitiesTests/ConvertActionTests.swift:1843:58: 'temporaryDirectory' is deprecated: Use `createTemporaryDirectory` instead in unit tests to avoid referencing a shared location in Swift CI.
/swift-docc/Tests/SwiftDocCUtilitiesTests/ConvertActionTests.swift:1910:64: 'temporaryDirectory' is deprecated: Use `createTemporaryDirectory` instead in unit tests to avoid referencing a shared location in Swift CI.
/swift-docc/Tests/SwiftDocCTests/Converter/DocumentationConverterTests.swift:29:43: 'temporaryDirectory' is deprecated: Use `createTemporaryDirectory` instead in unit tests to avoid referencing a shared location in Swift CI.
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.
Great. I didn't think that would work. I'll incorporate the changes. Thanks!
Sources/SwiftDocCTestUtilities/XCTestCase+TemporaryDirectory.swift
Outdated
Show resolved
Hide resolved
Sources/SwiftDocCTestUtilities/XCTestCase+TemporaryDirectory.swift
Outdated
Show resolved
Hide resolved
145e5fb
to
8c614df
Compare
Sources/SwiftDocCTestUtilities/XCTestCase+TemporaryDirectory.swift
Outdated
Show resolved
Hide resolved
Tests/SwiftDocCTests/Infrastructure/DocumentationContext+RootPageTests.swift
Outdated
Show resolved
Hide resolved
/// - pathComponents: Additional path components to add to the temporary URL. | ||
/// - fileManager: The file manager that will create the directory. | ||
/// - Returns: The URL of the newly created directory. | ||
func createTemporaryDirectory(pathComponents: String..., fileManager: FileManager = .default) throws -> URL { |
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.
I think all of our current uses of this just specify a single path component because they need a specifically named temporary directory. Maybe this would be easier to understand at the callsite with something like-
func createTemporaryDirectory(pathComponents: String..., fileManager: FileManager = .default) throws -> URL { | |
func createTemporaryDirectory(named directoryName: String? = nil, fileManager: FileManager = .default) throws -> URL { |
/// - Returns: The URL of the newly created directory. | ||
func createTemporaryDirectory(pathComponents: String..., fileManager: FileManager = .default) throws -> URL { | ||
let bundleParentDir = Bundle(for: Self.self).bundleURL.deletingLastPathComponent() | ||
let baseURL = bundleParentDir.appendingPathComponent(name.replacingWhitespaceAndPunctuation(with: "-")) |
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.
Should we consider creating a parent TemporarySwiftDocCTestDirectory-\(some-static-unique-process-identifier)
to place the individual test directories based on the test name in? Otherwise I think it's possible we'd run into collisions in the future.
I'm imagining something like:
// Define this statically so that we don't generate a new unique base directory
// every time we create a temporary directory
private static let uniqueProcessIdentifier = ProcessInfo.processInfo.globallyUniqueString
let baseURL = bundleParentDir.appendingPathComponent(name.replacingWhitespaceAndPunctuation(with: "-")) | |
let baseURL = bundleParentDir | |
.appendingPathComponent( | |
"TemporarySwiftDocCTestDirectory-\(uniqueProcessIdentifier)", | |
isDirectory: true | |
) | |
.appendingPathComponent( | |
name.replacingWhitespaceAndPunctuation(with: "-"), | |
isDirectory: true | |
) |
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.
Collisions shouldn't be an issue here.
The bundleParentDir
is a path inside the build directory for the specific checkout, so that should be unique if Swift CI is testing two different builds of Swift-DocC at the same time.
The name
that's used in the base URL contains both the name of the test class and the test case.
Together this means that only tests in the same checkout and in the same test method will have the same base URL. Since the teardown block runs after the test method there's no risk that a base URL is removed while there are tests working on subpaths of that URL.
The first path component within each test base URL is ProcessInfo.processInfo.globallyUniqueString
so two different temp directories in the same test method also wouldn't have collisions.
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.
The name that's used in the base URL contains both the name of the test class and the test case.
Ah got it- based on the docs I was assuming that it was just the name of the test case so I'm less concerned then.
However- the collisions I was more worried about are with other items in the bundle, for example if we added a new TestDocC target and SwiftPM emitted a new directory there to hold its output. The chances of collision seem very low though since it's both the test class and test case so I think this is okay.
|
||
public extension XCTestCase { | ||
|
||
@available(*, deprecated, message: "Use `createTemporaryDirectory` instead in unit tests to avoid referencing a shared location in Swift CI.") |
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.
Can we do this for FileManager.default.temporaryDirectory as well? Not sure if Swift will allow that...
adfe92c
to
cc3d57d
Compare
@swift-ci please test |
This is clearer at the call site when only a single path component is specified.
@swift-ci please test |
@@ -200,7 +203,8 @@ public struct ConvertAction: Action, RecreatingContext { | |||
inheritDocs: Bool = false, | |||
experimentalEnableCustomTemplates: Bool = false, | |||
transformForStaticHosting: Bool, | |||
hostingBasePath: String? | |||
hostingBasePath: String?, | |||
temporaryDirectory: URL |
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.
Nit: this is slightly odd as parameter with no default value for ConvertAction
. I wouldn't expect clients to need to provide a temporary directory, since using a temporary directory is an implementation detail of ConvertAction
. Should we set a default value of FileManager.default.temporaryDirectory
?
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.
I would prefer to not provide a default value for this argument to avoid mistakes where a test would forget to provide a custom value.
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.
Thanks David, this looks great to me! Appreciate the thoroughness 💯
@swift-ci please test |
* Add utility to create temp directories in unit tests * Create new target for test utilities * Pass the temporary directory to ConvertAction * Re-enable one skipped test * Update new tests to use `createTemporaryDirectory` helper * Remove `createDirectoryForLastPathComponent` argument in test helper * Update test helper documentation * Prefer `FileManager.temporaryDirectory` property in ConvertAction * Move `Files` and `Folder` types into test utility target * Add additional safety checks when creating and removing temporary directories * Replace `TempFolder` test class with `createTempFolder` test function * Use XCTUnwrap instead of force unwrap in test helper * Also shadow `FileManager.temporaryDirectory` in tests * Add temp directory test helper variant with "named" argument This is clearer at the call site when only a single path component is specified. * Fix test helper syntax in disabled preview server test * Re-enable one file monitoring test
* Add utility to create temp directories in unit tests * Create new target for test utilities * Pass the temporary directory to ConvertAction * Re-enable one skipped test * Update new tests to use `createTemporaryDirectory` helper * Remove `createDirectoryForLastPathComponent` argument in test helper * Update test helper documentation * Prefer `FileManager.temporaryDirectory` property in ConvertAction * Move `Files` and `Folder` types into test utility target * Add additional safety checks when creating and removing temporary directories * Replace `TempFolder` test class with `createTempFolder` test function * Use XCTUnwrap instead of force unwrap in test helper * Also shadow `FileManager.temporaryDirectory` in tests * Add temp directory test helper variant with "named" argument This is clearer at the call site when only a single path component is specified. * Fix test helper syntax in disabled preview server test * Re-enable one file monitoring test
It looks like
|
Updates swift-markdown to include: commit 97df6e2812adcf8698204ca5f0756563ef36e5c1 Author: Ethan Kusters <ekusters@apple.com> Date: Sat May 21 14:02:22 2022 -0700 Correctly set `indexInParent` in `Markup.child(at:)` (swiftlang#45) This fixes a recent regression where `Markup.child(at:)` began returning markup with incorrect metadata resulting in out-of-bounds errors. The `indexInParent` value of a child is unrelated to the parent's `indexInParent`. This was missed initially because tests were only checking for children of the first item where `indexInParent` would be 0. A new test has been added that asserts `Markup.child(at:)` returns correct values for children of nested items as well. commit 7a7c59d1160fddd23e2379ec5ee8c71df7fd0b3b Author: Ethan Kusters <ekusters@apple.com> Date: Fri May 20 18:53:24 2022 -0700 Improve performance of `Markup.child(at:)` method (swiftlang#44) Improves the performance of `Markup.child(at:)` by refactoring to removing the need to iterate over all previous elements in the child array. commit 36cf89e36e94b025dbe37d82fe2a7da3f39d4204 Author: Franklin Schrans <fschrans@apple.com> Date: Wed Mar 23 14:38:18 2022 +0100 Remove extraneous print in test (swiftlang#33) commit e50693584310a9190071c96c839485b6f2376832 Author: Ethan Kusters <ekusters@apple.com> Date: Mon Mar 21 10:42:02 2022 -0700 Publish Swift Markdown's documentation to GitHub pages (swiftlang#32) * Adopt the Swift-DocC Plugin for documentation generation * Add a script for publishing docs to GitHub pages * Add missing license headers * Move README docs to articles in the DocC catalog * Remove out-of-date documentation about `DiagnosticEngine` Swift markdown no longer includes a DiagnosticEngine so these links were failing to resolve. commit 5f10cfb030f43222a49ea34857ff07f02f1e38b0 Author: christopherweems <github@christopherweems.com> Date: Sat Mar 19 12:53:31 2022 -0400 Fix typo in documentation for `MarkupVisitor` (swiftlang#26) Co-authored-by: Christopher Weems <hello@christopherweems.com>
Updates swift-markdown to include: commit 97df6e2812adcf8698204ca5f0756563ef36e5c1 Author: Ethan Kusters <ekusters@apple.com> Date: Sat May 21 14:02:22 2022 -0700 Correctly set `indexInParent` in `Markup.child(at:)` (swiftlang#45) This fixes a recent regression where `Markup.child(at:)` began returning markup with incorrect metadata resulting in out-of-bounds errors. The `indexInParent` value of a child is unrelated to the parent's `indexInParent`. This was missed initially because tests were only checking for children of the first item where `indexInParent` would be 0. A new test has been added that asserts `Markup.child(at:)` returns correct values for children of nested items as well. commit 7a7c59d1160fddd23e2379ec5ee8c71df7fd0b3b Author: Ethan Kusters <ekusters@apple.com> Date: Fri May 20 18:53:24 2022 -0700 Improve performance of `Markup.child(at:)` method (swiftlang#44) Improves the performance of `Markup.child(at:)` by refactoring to removing the need to iterate over all previous elements in the child array. commit 36cf89e36e94b025dbe37d82fe2a7da3f39d4204 Author: Franklin Schrans <fschrans@apple.com> Date: Wed Mar 23 14:38:18 2022 +0100 Remove extraneous print in test (swiftlang#33) commit e50693584310a9190071c96c839485b6f2376832 Author: Ethan Kusters <ekusters@apple.com> Date: Mon Mar 21 10:42:02 2022 -0700 Publish Swift Markdown's documentation to GitHub pages (swiftlang#32) * Adopt the Swift-DocC Plugin for documentation generation * Add a script for publishing docs to GitHub pages * Add missing license headers * Move README docs to articles in the DocC catalog * Remove out-of-date documentation about `DiagnosticEngine` Swift markdown no longer includes a DiagnosticEngine so these links were failing to resolve. commit 5f10cfb030f43222a49ea34857ff07f02f1e38b0 Author: christopherweems <github@christopherweems.com> Date: Sat Mar 19 12:53:31 2022 -0400 Fix typo in documentation for `MarkupVisitor` (swiftlang#26) Co-authored-by: Christopher Weems <hello@christopherweems.com>
Updates swift-markdown to include: commit 97df6e2812adcf8698204ca5f0756563ef36e5c1 Author: Ethan Kusters <ekusters@apple.com> Date: Sat May 21 14:02:22 2022 -0700 Correctly set `indexInParent` in `Markup.child(at:)` (swiftlang#45) This fixes a recent regression where `Markup.child(at:)` began returning markup with incorrect metadata resulting in out-of-bounds errors. The `indexInParent` value of a child is unrelated to the parent's `indexInParent`. This was missed initially because tests were only checking for children of the first item where `indexInParent` would be 0. A new test has been added that asserts `Markup.child(at:)` returns correct values for children of nested items as well. commit 7a7c59d1160fddd23e2379ec5ee8c71df7fd0b3b Author: Ethan Kusters <ekusters@apple.com> Date: Fri May 20 18:53:24 2022 -0700 Improve performance of `Markup.child(at:)` method (swiftlang#44) Improves the performance of `Markup.child(at:)` by refactoring to removing the need to iterate over all previous elements in the child array. commit 36cf89e36e94b025dbe37d82fe2a7da3f39d4204 Author: Franklin Schrans <fschrans@apple.com> Date: Wed Mar 23 14:38:18 2022 +0100 Remove extraneous print in test (swiftlang#33) commit e50693584310a9190071c96c839485b6f2376832 Author: Ethan Kusters <ekusters@apple.com> Date: Mon Mar 21 10:42:02 2022 -0700 Publish Swift Markdown's documentation to GitHub pages (swiftlang#32) * Adopt the Swift-DocC Plugin for documentation generation * Add a script for publishing docs to GitHub pages * Add missing license headers * Move README docs to articles in the DocC catalog * Remove out-of-date documentation about `DiagnosticEngine` Swift markdown no longer includes a DiagnosticEngine so these links were failing to resolve. commit 5f10cfb030f43222a49ea34857ff07f02f1e38b0 Author: christopherweems <github@christopherweems.com> Date: Sat Mar 19 12:53:31 2022 -0400 Fix typo in documentation for `MarkupVisitor` (swiftlang#26) Co-authored-by: Christopher Weems <hello@christopherweems.com>
Updates swift-markdown to include: commit 97df6e2812adcf8698204ca5f0756563ef36e5c1 Author: Ethan Kusters <ekusters@apple.com> Date: Sat May 21 14:02:22 2022 -0700 Correctly set `indexInParent` in `Markup.child(at:)` (swiftlang#45) This fixes a recent regression where `Markup.child(at:)` began returning markup with incorrect metadata resulting in out-of-bounds errors. The `indexInParent` value of a child is unrelated to the parent's `indexInParent`. This was missed initially because tests were only checking for children of the first item where `indexInParent` would be 0. A new test has been added that asserts `Markup.child(at:)` returns correct values for children of nested items as well. commit 7a7c59d1160fddd23e2379ec5ee8c71df7fd0b3b Author: Ethan Kusters <ekusters@apple.com> Date: Fri May 20 18:53:24 2022 -0700 Improve performance of `Markup.child(at:)` method (swiftlang#44) Improves the performance of `Markup.child(at:)` by refactoring to removing the need to iterate over all previous elements in the child array. commit 36cf89e36e94b025dbe37d82fe2a7da3f39d4204 Author: Franklin Schrans <fschrans@apple.com> Date: Wed Mar 23 14:38:18 2022 +0100 Remove extraneous print in test (swiftlang#33) commit e50693584310a9190071c96c839485b6f2376832 Author: Ethan Kusters <ekusters@apple.com> Date: Mon Mar 21 10:42:02 2022 -0700 Publish Swift Markdown's documentation to GitHub pages (swiftlang#32) * Adopt the Swift-DocC Plugin for documentation generation * Add a script for publishing docs to GitHub pages * Add missing license headers * Move README docs to articles in the DocC catalog * Remove out-of-date documentation about `DiagnosticEngine` Swift markdown no longer includes a DiagnosticEngine so these links were failing to resolve. commit 5f10cfb030f43222a49ea34857ff07f02f1e38b0 Author: christopherweems <github@christopherweems.com> Date: Sat Mar 19 12:53:31 2022 -0400 Fix typo in documentation for `MarkupVisitor` (swiftlang#26) Co-authored-by: Christopher Weems <hello@christopherweems.com>
Updates swift-markdown to include: commit 97df6e2812adcf8698204ca5f0756563ef36e5c1 Author: Ethan Kusters <ekusters@apple.com> Date: Sat May 21 14:02:22 2022 -0700 Correctly set `indexInParent` in `Markup.child(at:)` (swiftlang#45) This fixes a recent regression where `Markup.child(at:)` began returning markup with incorrect metadata resulting in out-of-bounds errors. The `indexInParent` value of a child is unrelated to the parent's `indexInParent`. This was missed initially because tests were only checking for children of the first item where `indexInParent` would be 0. A new test has been added that asserts `Markup.child(at:)` returns correct values for children of nested items as well. commit 7a7c59d1160fddd23e2379ec5ee8c71df7fd0b3b Author: Ethan Kusters <ekusters@apple.com> Date: Fri May 20 18:53:24 2022 -0700 Improve performance of `Markup.child(at:)` method (swiftlang#44) Improves the performance of `Markup.child(at:)` by refactoring to removing the need to iterate over all previous elements in the child array. commit 36cf89e36e94b025dbe37d82fe2a7da3f39d4204 Author: Franklin Schrans <fschrans@apple.com> Date: Wed Mar 23 14:38:18 2022 +0100 Remove extraneous print in test (swiftlang#33) commit e50693584310a9190071c96c839485b6f2376832 Author: Ethan Kusters <ekusters@apple.com> Date: Mon Mar 21 10:42:02 2022 -0700 Publish Swift Markdown's documentation to GitHub pages (swiftlang#32) * Adopt the Swift-DocC Plugin for documentation generation * Add a script for publishing docs to GitHub pages * Add missing license headers * Move README docs to articles in the DocC catalog * Remove out-of-date documentation about `DiagnosticEngine` Swift markdown no longer includes a DiagnosticEngine so these links were failing to resolve. commit 5f10cfb030f43222a49ea34857ff07f02f1e38b0 Author: christopherweems <github@christopherweems.com> Date: Sat Mar 19 12:53:31 2022 -0400 Fix typo in documentation for `MarkupVisitor` (swiftlang#26) Co-authored-by: Christopher Weems <hello@christopherweems.com>
Updates swift-markdown to include: commit 97df6e2812adcf8698204ca5f0756563ef36e5c1 Author: Ethan Kusters <ekusters@apple.com> Date: Sat May 21 14:02:22 2022 -0700 Correctly set `indexInParent` in `Markup.child(at:)` (swiftlang#45) This fixes a recent regression where `Markup.child(at:)` began returning markup with incorrect metadata resulting in out-of-bounds errors. The `indexInParent` value of a child is unrelated to the parent's `indexInParent`. This was missed initially because tests were only checking for children of the first item where `indexInParent` would be 0. A new test has been added that asserts `Markup.child(at:)` returns correct values for children of nested items as well. commit 7a7c59d1160fddd23e2379ec5ee8c71df7fd0b3b Author: Ethan Kusters <ekusters@apple.com> Date: Fri May 20 18:53:24 2022 -0700 Improve performance of `Markup.child(at:)` method (swiftlang#44) Improves the performance of `Markup.child(at:)` by refactoring to removing the need to iterate over all previous elements in the child array. commit 36cf89e36e94b025dbe37d82fe2a7da3f39d4204 Author: Franklin Schrans <fschrans@apple.com> Date: Wed Mar 23 14:38:18 2022 +0100 Remove extraneous print in test (swiftlang#33) commit e50693584310a9190071c96c839485b6f2376832 Author: Ethan Kusters <ekusters@apple.com> Date: Mon Mar 21 10:42:02 2022 -0700 Publish Swift Markdown's documentation to GitHub pages (swiftlang#32) * Adopt the Swift-DocC Plugin for documentation generation * Add a script for publishing docs to GitHub pages * Add missing license headers * Move README docs to articles in the DocC catalog * Remove out-of-date documentation about `DiagnosticEngine` Swift markdown no longer includes a DiagnosticEngine so these links were failing to resolve. commit 5f10cfb030f43222a49ea34857ff07f02f1e38b0 Author: christopherweems <github@christopherweems.com> Date: Sat Mar 19 12:53:31 2022 -0400 Fix typo in documentation for `MarkupVisitor` (swiftlang#26) Co-authored-by: Christopher Weems <hello@christopherweems.com>
Updates swift-markdown to include: commit 97df6e2812adcf8698204ca5f0756563ef36e5c1 Author: Ethan Kusters <ekusters@apple.com> Date: Sat May 21 14:02:22 2022 -0700 Correctly set `indexInParent` in `Markup.child(at:)` (swiftlang#45) This fixes a recent regression where `Markup.child(at:)` began returning markup with incorrect metadata resulting in out-of-bounds errors. The `indexInParent` value of a child is unrelated to the parent's `indexInParent`. This was missed initially because tests were only checking for children of the first item where `indexInParent` would be 0. A new test has been added that asserts `Markup.child(at:)` returns correct values for children of nested items as well. commit 7a7c59d1160fddd23e2379ec5ee8c71df7fd0b3b Author: Ethan Kusters <ekusters@apple.com> Date: Fri May 20 18:53:24 2022 -0700 Improve performance of `Markup.child(at:)` method (swiftlang#44) Improves the performance of `Markup.child(at:)` by refactoring to removing the need to iterate over all previous elements in the child array. commit 36cf89e36e94b025dbe37d82fe2a7da3f39d4204 Author: Franklin Schrans <fschrans@apple.com> Date: Wed Mar 23 14:38:18 2022 +0100 Remove extraneous print in test (swiftlang#33) commit e50693584310a9190071c96c839485b6f2376832 Author: Ethan Kusters <ekusters@apple.com> Date: Mon Mar 21 10:42:02 2022 -0700 Publish Swift Markdown's documentation to GitHub pages (swiftlang#32) * Adopt the Swift-DocC Plugin for documentation generation * Add a script for publishing docs to GitHub pages * Add missing license headers * Move README docs to articles in the DocC catalog * Remove out-of-date documentation about `DiagnosticEngine` Swift markdown no longer includes a DiagnosticEngine so these links were failing to resolve. commit 5f10cfb030f43222a49ea34857ff07f02f1e38b0 Author: christopherweems <github@christopherweems.com> Date: Sat Mar 19 12:53:31 2022 -0400 Fix typo in documentation for `MarkupVisitor` (swiftlang#26) Co-authored-by: Christopher Weems <hello@christopherweems.com>
Updates swift-markdown to include: commit 97df6e2812adcf8698204ca5f0756563ef36e5c1 Author: Ethan Kusters <ekusters@apple.com> Date: Sat May 21 14:02:22 2022 -0700 Correctly set `indexInParent` in `Markup.child(at:)` (#45) This fixes a recent regression where `Markup.child(at:)` began returning markup with incorrect metadata resulting in out-of-bounds errors. The `indexInParent` value of a child is unrelated to the parent's `indexInParent`. This was missed initially because tests were only checking for children of the first item where `indexInParent` would be 0. A new test has been added that asserts `Markup.child(at:)` returns correct values for children of nested items as well. commit 7a7c59d1160fddd23e2379ec5ee8c71df7fd0b3b Author: Ethan Kusters <ekusters@apple.com> Date: Fri May 20 18:53:24 2022 -0700 Improve performance of `Markup.child(at:)` method (#44) Improves the performance of `Markup.child(at:)` by refactoring to removing the need to iterate over all previous elements in the child array. commit 36cf89e36e94b025dbe37d82fe2a7da3f39d4204 Author: Franklin Schrans <fschrans@apple.com> Date: Wed Mar 23 14:38:18 2022 +0100 Remove extraneous print in test (#33) commit e50693584310a9190071c96c839485b6f2376832 Author: Ethan Kusters <ekusters@apple.com> Date: Mon Mar 21 10:42:02 2022 -0700 Publish Swift Markdown's documentation to GitHub pages (#32) * Adopt the Swift-DocC Plugin for documentation generation * Add a script for publishing docs to GitHub pages * Add missing license headers * Move README docs to articles in the DocC catalog * Remove out-of-date documentation about `DiagnosticEngine` Swift markdown no longer includes a DiagnosticEngine so these links were failing to resolve. commit 5f10cfb030f43222a49ea34857ff07f02f1e38b0 Author: christopherweems <github@christopherweems.com> Date: Sat Mar 19 12:53:31 2022 -0400 Fix typo in documentation for `MarkupVisitor` (#26) Co-authored-by: Christopher Weems <hello@christopherweems.com>
Includes the following changes: commit 7e704622ef98b3cc9233283b6298ed61806ddb43 Author: Ethan Kusters <ekusters@apple.com> Date: Sat May 21 14:02:22 2022 -0700 Correctly set `indexInParent` in `Markup.child(at:)` (swiftlang#45) This fixes a recent regression where `Markup.child(at:)` began returning markup with incorrect metadata resulting in out-of-bounds errors. The `indexInParent` value of a child is unrelated to the parent's `indexInParent`. This was missed initially because tests were only checking for children of the first item where `indexInParent` would be 0. A new test has been added that asserts `Markup.child(at:)` returns correct values for children of nested items as well. commit 5cc5656732244237066214bc976570f67cfe47b7 Author: Ethan Kusters <ekusters@apple.com> Date: Fri May 20 18:53:24 2022 -0700 Improve performance of `Markup.child(at:)` method (swiftlang#44) Improves the performance of `Markup.child(at:)` by refactoring to removing the need to iterate over all previous elements in the child array.
Includes the following changes: commit 7e704622ef98b3cc9233283b6298ed61806ddb43 Author: Ethan Kusters <ekusters@apple.com> Date: Sat May 21 14:02:22 2022 -0700 Correctly set `indexInParent` in `Markup.child(at:)` (swiftlang#45) This fixes a recent regression where `Markup.child(at:)` began returning markup with incorrect metadata resulting in out-of-bounds errors. The `indexInParent` value of a child is unrelated to the parent's `indexInParent`. This was missed initially because tests were only checking for children of the first item where `indexInParent` would be 0. A new test has been added that asserts `Markup.child(at:)` returns correct values for children of nested items as well. commit 5cc5656732244237066214bc976570f67cfe47b7 Author: Ethan Kusters <ekusters@apple.com> Date: Fri May 20 18:53:24 2022 -0700 Improve performance of `Markup.child(at:)` method (swiftlang#44) Improves the performance of `Markup.child(at:)` by refactoring to removing the need to iterate over all previous elements in the child array.
Includes the following changes: commit 7e704622ef98b3cc9233283b6298ed61806ddb43 Author: Ethan Kusters <ekusters@apple.com> Date: Sat May 21 14:02:22 2022 -0700 Correctly set `indexInParent` in `Markup.child(at:)` (#45) This fixes a recent regression where `Markup.child(at:)` began returning markup with incorrect metadata resulting in out-of-bounds errors. The `indexInParent` value of a child is unrelated to the parent's `indexInParent`. This was missed initially because tests were only checking for children of the first item where `indexInParent` would be 0. A new test has been added that asserts `Markup.child(at:)` returns correct values for children of nested items as well. commit 5cc5656732244237066214bc976570f67cfe47b7 Author: Ethan Kusters <ekusters@apple.com> Date: Fri May 20 18:53:24 2022 -0700 Improve performance of `Markup.child(at:)` method (#44) Improves the performance of `Markup.child(at:)` by refactoring to removing the need to iterate over all previous elements in the child array.
Bug/issue #, if applicable: rdar://85055022
Summary
This updates the tests to no longer write data in
NSTemporaryDirectory()
.Dependencies
n/a
Testing
n/a
Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded