Skip to content
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

Miscellaneous test changes to avoid making assumptions about what's a valid URL #586

Merged
merged 13 commits into from Jul 26, 2023

Conversation

d-ronnqvist
Copy link
Contributor

Bug/issue #, if applicable: rdar://108237260

Summary

This makes a handful of changes, mainly in tests, to avoid making assumptions about what's a valid URL. Each change is its own commit that describe the reason for that change.

Note: It also makes one behavioral change by formalizing the requirement that source repository base URLs specify both a scheme and a host.

I think that's the type of values we expect for this configuration. If we don't have any specific validation for these values I think we should remove those test assertions (and possibly use a string instead of a URL)

Dependencies

None

Testing

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

@d-ronnqvist d-ronnqvist marked this pull request as ready for review May 16, 2023 17:07
@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

# Conflicts:
#	Package.resolved
@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@@ -54,7 +54,7 @@ class ResolvedTopicReferenceTests: XCTestCase {
do {
let resolvedOriginal = ResolvedTopicReference(bundleIdentifier: "bundleID", path: "/path/sub-path", fragment: "fragment", sourceLanguage: .swift)

let unresolved = UnresolvedTopicReference(topicURL: ValidatedURL(parsingExact: "doc://host.name/;;;")!)
let unresolved = UnresolvedTopicReference(topicURL: ValidatedURL(parsingExact: "doc://host.name/ ")!)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Suite 'Selected tests' started at 2023-07-25 18:53:24.131
Test Suite 'SwiftDocCPackageTests.xctest' started at 2023-07-25 18:53:24.132
Test Suite 'ResolvedTopicReferenceTests' started at 2023-07-25 18:53:24.132
Test Case '-[SwiftDocCTests.ResolvedTopicReferenceTests testAppendingReferenceWithEmptyPath]' started.
SwiftDocCTests/ResolvedTopicReferenceTests.swift:57: Fatal error: Unexpectedly found nil while unwrapping an Optional value

Looks like this change made this URL initializer fail in CI.

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist merged commit 6478439 into apple:main Jul 26, 2023
2 checks passed
@d-ronnqvist d-ronnqvist deleted the small-test-changes branch July 26, 2023 18:14
d-ronnqvist added a commit to d-ronnqvist/swift-docc that referenced this pull request Jul 26, 2023
… valid URL (apple#586)

* Avoid assumption about order of encoded JSON in test

* Remove test that verifies what characters redirect path support

(This is verifying Foundation behavior that's not redirect specific)

* Simplify test that only verify validation of one URL string

* Require that source repository base URLs include scheme and host

* Avoid testing curation of headings (this isn't supported)

* Update test URL to use characters that DocC will replace with "-"

* Only print the preview URL if it's non-nil

(In practice the port is validated before this but some tests skip that)

* Update Swift-Markdown to pick up a index-out-of-bounds fix

* Update test URL to use other non-path-allows characters

* Revert "Update test URL to use characters that DocC will replace with "-""

7d1f3bd

rdar://108237260
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants