test(editor): move the editor's own suites into the package and close the testable seam - #2891
Merged
Merged
Conversation
…tor and rename its modules
…e is toolchain-independent
…package # Conflicts: # CLAUDE.md # LocalPackages/CodeEditTextView/Sources/CodeEditTextView/CodeEditTextView.swift # Packages/TableProEditor/Sources/TableProEditorKit/Controller/TextViewController+TextViewDelegate.swift # Packages/TableProEditor/Sources/TableProEditorKit/Controller/TextViewController+ToggleComment.swift # Packages/TableProEditor/Sources/TableProEditorKit/Extensions/NSRange+/NSRange+InputEdit.swift # Packages/TableProEditor/Sources/TableProEditorKit/Extensions/TextView+/TextView+Point.swift # Packages/TableProEditor/Sources/TableProEditorKit/Extensions/TextView+/TextView+TextFormation.swift # Packages/TableProEditor/Sources/TableProEditorKit/Extensions/TextView+/TextView+createReadBlock.swift # Packages/TableProEditor/Sources/TableProEditorKit/Filters/DeleteWhitespaceFilter.swift # Packages/TableProEditor/Sources/TableProEditorKit/Find/PanelView/FindPanelView.swift # Packages/TableProEditor/Sources/TableProEditorKit/Find/ViewModel/FindPanelViewModel+Replace.swift # Packages/TableProEditor/Sources/TableProEditorKit/Find/ViewModel/FindPanelViewModel.swift # Packages/TableProEditor/Sources/TableProEditorKit/SourceEditor/SourceEditor+Coordinator.swift # Packages/TableProEditor/Sources/TableProEditorKit/TextViewCoordinator/CombineCoordinator.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/CaptureModifierSetTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/CodeEditSourceEditorTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/Controller/TextViewController+IndentTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/Controller/TextViewController+MoveLinesTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/Controller/TextViewControllerTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/FindPanelTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/GutterNumberOffsetTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/Highlighting/StyledRangeContainerTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/Highlighting/VisibleRangeProviderTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/LineFoldingTests/LineFoldAccessibilityTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/LineFoldingTests/LineFoldChunkBoundaryTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/LineFoldingTests/LineFoldCollapsePathTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/LineFoldingTests/LineFoldDocumentSwapTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/LineFoldingTests/LineFoldHoverTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/LineFoldingTests/LineFoldPlaceholderClickTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/LineFoldingTests/LineFoldRibbonLookupTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/LineFoldingTests/LineFoldStorageTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/LineFoldingTests/LineFoldingModelTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/RangeStoreTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/TreeSitterClientTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/AccessibilityTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/CmdUpAtEndOfDocumentTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/IMEInputTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/KillRingTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/LayoutManager/OverridingLayoutManagerRenderingTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/LayoutManager/TextLayoutManagerAttachmentsTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/LayoutManager/TextLayoutManagerTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/LineEndingTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/MarkedTextTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/NSBezierPathSmoothPathTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/NSTextInputRangeGuardTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/TextLayoutLineStorageTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/TextLineDisplayRangeTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/TextSelectionManagerTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/TextViewTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/TypesetterTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/VisualLineEndOfDocumentTests.swift # Packages/TableProEditor/Tests/TableProTextEngineTests/WordSelectionTests.swift
… the testable seam
…seam # Conflicts: # Packages/TableProEditor/Tests/TableProEditorKitTests/Controller/EditorPeripheralSurfaceTests.swift # Packages/TableProEditor/Tests/TableProEditorKitTests/SyntaxHighlightingTests.swift # TableProTests/Views/Editor/EditorControllerFixture.swift # TableProTests/Views/Editor/EditorLifecycleTeardownTests.swift # TableProTests/Views/Editor/QueryDiagnosticsRefreshTests.swift # TableProTests/Views/Editor/RemoveInvisibleCharactersCommandTests.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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stacked on #2886.
Thirteen files in
TableProTestsreached into the editor with@testable import, which is theseam a package boundary is supposed to remove: anything the app's tests can only say by opening
the module is either a test that belongs inside the package, or API the package should have.
Afterwards there are zero
@testableimports ofTableProEditorKitorTableProTextEngineoutside the package, and exactly one symbol was promoted.
Nine suites moved into the package
They test the editor and never mention an app type, so they belong with the editor. They also run
in
swift test, which is seconds, instead of behind a full app build.TableProEditorKitTests/SyntaxHighlightingTestsTableProEditorKitTests/Controller/EditorPeripheralSurfaceTestsTableProEditorKitTests/Controller/EditorKeyMonitorCompositionTestsTableProEditorKitTests/Controller/LongLineScrollTestsTableProEditorKitTests/GutterHighlightTestsTableProEditorKitTests/LargePasteTestsTableProEditorKitTests/Highlighting/PasteHighlightCancelTestsTableProEditorKitTests/SourceEditorDismantleTestsdismantleNSViewControllerdestroying each coordinator onceTableProTextEngineTests/TypesetterWrapLengthTestsTwo of those were carved out of app suites that do need the app:
SyntaxHighlightingTestsleftits
ThemeEnginecase behind asEditorThemeBridgeTests, andEditorLifecycleTeardownTestskepteverything about
SQLEditorCoordinatorandWorkspacePanes.One promotion, and two tests rewritten instead
EmphasisManager.toolTip(at:)is now public. An emphasis owns its tool tip and AppKit only everasks the owner, so this is the only way anything outside the manager can read what the editor
would show under the pointer. The app-side diagnostics test was reaching
textViewandtoolTipsseparately to hand-roll it.QueryDiagnosticsRefreshTestsbuilt aTextBindingSyncand aRepresentableSyncPhaseto pushtext the way
SourceEditor's binding does. That plumbing is the package's, andSourceEditorBindingSyncTestsalready covers it in twelve cases; what the app test is actuallyfor is that a second replacement re-checks, which
setTextsays directly.RemoveInvisibleCharactersCommandTestsassertedisApplyingUnfilteredEdits == falseto mean"the filters are back on". That only says a flag was cleared. It now types a bracket and expects
the pair, which is the filters actually running.
Two fixes the move surfaced
Mock.loadedTextViewControllerdefaults towrapLines: false. A wrapped editor cannot scrollhorizontally, so the long-line suite measured nothing once it took the package's fixture.
LineFoldChunkBoundaryTestswaits for an async calculation on the main actor with a deadlinethat turns a hang into a failure. Five seconds was enough for that target before; with the
editor's own suites in it, it was not. The deadline is 60 seconds now; the loop still exits the
moment the condition holds.
Verification
swift test --package-path Packages/TableProEditor --force-resolved-versions: 336 engine casesand 145 kit cases, 0 failures (was 333 and 102).
xcodebuild build-for-testing: 0 errors, so nothing in the app's test target needed the seam.verify.sh testover the five app suites this touched: 24 of 24 pass.swiftlint lint --strict: 0 violations.No CHANGELOG entry: tests only.