Skip to content

Commit 8eb9bcd

Browse files
DanTupCommit Queue
authored andcommitted
[analysis_server] Verify with/without documentChanges for EditArguments tests
The tests by default run with documentChanges (set in `setUp`), but it's possible LSP-over-Legacy clients won't support it. Change-Id: I40c65f05127c88e15a43f16669f64675285955dc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406002 Reviewed-by: Samuel Rawlins <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 04484a2 commit 8eb9bcd

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

pkg/analysis_server/test/shared/shared_edit_argument_tests.dart

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ mixin SharedEditArgumentTests
2828
Future<void> setUp() async {
2929
await super.setUp();
3030
setApplyEditSupport();
31+
setDocumentChangesSupport();
3132
}
3233

3334
test_comma_addArg_addsIfExists() async {
@@ -66,6 +67,30 @@ mixin SharedEditArgumentTests
6667
);
6768
}
6869

70+
test_documentChanges_supported() async {
71+
// Ensure documentChanges are supported. The verification in
72+
// LspChangeVerifier will verify the resulting edits match the capabilities.
73+
setDocumentChangesSupport();
74+
await _expectSimpleArgumentEdit(
75+
params: '({ int? x })',
76+
originalArgs: '(x: 1)',
77+
edit: ArgumentEdit(name: 'x', newValue: 2),
78+
expectedArgs: '(x: 2)',
79+
);
80+
}
81+
82+
test_documentChanges_unsupported() async {
83+
// documentChanges are NOT supported. The verification in
84+
// LspChangeVerifier will verify the resulting edits match the capabilities.
85+
setDocumentChangesSupport(false);
86+
await _expectSimpleArgumentEdit(
87+
params: '({ int? x })',
88+
originalArgs: '(x: 1)',
89+
edit: ArgumentEdit(name: 'x', newValue: 2),
90+
expectedArgs: '(x: 2)',
91+
);
92+
}
93+
6994
test_format_multiline_insert_between() async {
7095
await _expectSimpleArgumentEdit(
7196
params: '({ int? x, int? y, int? children })',

0 commit comments

Comments
 (0)