Skip to content

Commit e866608

Browse files
committed
test: make diagnostic helper name match behavior
Rename check_code_for to has_no_diagnostic so assertions describe the existing behavior directly. Assisted-by: Codex
1 parent 192e3d7 commit e866608

64 files changed

Lines changed: 636 additions & 636 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

crates/emmylua_code_analysis/src/compilation/test/and_or_test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod test {
66
fn test_issue_221() {
77
let mut ws = VirtualWorkspace::new();
88

9-
assert!(ws.check_code_for(
9+
assert!(ws.has_no_diagnostic(
1010
DiagnosticCode::NeedCheckNil,
1111
r#"
1212
--- @param opts table|nil
@@ -30,7 +30,7 @@ mod test {
3030
fn test_issue_222() {
3131
let mut ws = VirtualWorkspace::new();
3232

33-
assert!(ws.check_code_for(
33+
assert!(ws.has_no_diagnostic(
3434
DiagnosticCode::AssignTypeMismatch,
3535
r#"
3636
local a --- @type boolean
@@ -111,7 +111,7 @@ mod test {
111111
fn test_issue_482() {
112112
let mut ws = VirtualWorkspace::new();
113113

114-
assert!(ws.check_code_for(
114+
assert!(ws.has_no_diagnostic(
115115
DiagnosticCode::AssignTypeMismatch,
116116
r#"
117117
local command_provider --- @type {commands: string[]}?
@@ -126,7 +126,7 @@ mod test {
126126
fn test_issue_644() {
127127
let mut ws = VirtualWorkspace::new();
128128

129-
assert!(ws.check_code_for(
129+
assert!(ws.has_no_diagnostic(
130130
DiagnosticCode::NeedCheckNil,
131131
r#"
132132
--- @alias mapfn fun()

crates/emmylua_code_analysis/src/compilation/test/annotation_test.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod test {
66
fn test_issue_223() {
77
let mut ws = VirtualWorkspace::new_with_init_std_lib();
88

9-
ws.check_code_for(
9+
ws.has_no_diagnostic(
1010
DiagnosticCode::ReturnTypeMismatch,
1111
r#"
1212
--- @return integer
@@ -117,7 +117,7 @@ mod test {
117117
fn test_generic_type_inference() {
118118
let mut ws = VirtualWorkspace::new();
119119

120-
assert!(!ws.check_code_for(
120+
assert!(!ws.has_no_diagnostic(
121121
DiagnosticCode::TypeNotFound,
122122
r#"
123123
---@class AnonymousObserver<T>: Observer<T>
@@ -129,7 +129,7 @@ mod test {
129129
fn test_class_super_cycle_filters_query_supers() {
130130
let mut ws = VirtualWorkspace::new();
131131

132-
assert!(!ws.check_code_for(
132+
assert!(!ws.has_no_diagnostic(
133133
DiagnosticCode::CircleDocClass,
134134
r#"
135135
---@class ClassCycleA: ClassCycleB
@@ -142,7 +142,7 @@ mod test {
142142
fn test_generic_class_super_cycle_reports_diagnostic() {
143143
let mut ws = VirtualWorkspace::new();
144144

145-
assert!(!ws.check_code_for(
145+
assert!(!ws.has_no_diagnostic(
146146
DiagnosticCode::CircleDocClass,
147147
r#"
148148
---@class GenericCycleA<T>: GenericCycleB<T>
@@ -322,7 +322,7 @@ mod test {
322322
fn test_type_return_usage() {
323323
let mut ws = VirtualWorkspace::new();
324324

325-
assert!(ws.check_code_for(
325+
assert!(ws.has_no_diagnostic(
326326
DiagnosticCode::AnnotationUsageError,
327327
r#"
328328
---@type string

crates/emmylua_code_analysis/src/compilation/test/array_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mod test {
2222
"#,
2323
);
2424

25-
assert!(ws.check_code_for(
25+
assert!(ws.has_no_diagnostic(
2626
DiagnosticCode::NeedCheckNil,
2727
r#"
2828
local a = items[index]
@@ -54,7 +54,7 @@ mod test {
5454
#[test]
5555
fn test_array_for_flow() {
5656
let mut ws = VirtualWorkspace::new();
57-
assert!(ws.check_code_for(
57+
assert!(ws.has_no_diagnostic(
5858
DiagnosticCode::NeedCheckNil,
5959
r#"
6060
--- @param _x string

crates/emmylua_code_analysis/src/compilation/test/attribute_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ mod test {
3333
fn test_def_attribute() {
3434
let mut ws = VirtualWorkspace::new_with_init_std_lib();
3535

36-
ws.check_code_for(
36+
ws.has_no_diagnostic(
3737
DiagnosticCode::AssignTypeMismatch,
3838
r#"
3939
---@[lsp_optimization("check_table_field")]

crates/emmylua_code_analysis/src/compilation/test/closure_generic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod test {
66
fn test_generic() {
77
let mut ws = VirtualWorkspace::new_with_init_std_lib();
88

9-
ws.check_code_for(
9+
ws.has_no_diagnostic(
1010
DiagnosticCode::TypeNotFound,
1111
r#"
1212
--- @generic T

crates/emmylua_code_analysis/src/compilation/test/closure_return_test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ mod test {
4343
fn test_issue_265() {
4444
let mut ws = VirtualWorkspace::new();
4545

46-
assert!(ws.check_code_for(
46+
assert!(ws.has_no_diagnostic(
4747
DiagnosticCode::ReturnTypeMismatch,
4848
r#"
4949
local function bar()
@@ -62,7 +62,7 @@ mod test {
6262
#[test]
6363
fn test_issue_464() {
6464
let mut ws = VirtualWorkspace::new();
65-
assert!(!ws.check_code_for_namespace(
65+
assert!(!ws.has_no_diagnostic_in_namespace(
6666
DiagnosticCode::ReturnTypeMismatch,
6767
r#"
6868
---@class D31
@@ -77,7 +77,7 @@ mod test {
7777
"#,
7878
));
7979

80-
assert!(ws.check_code_for_namespace(
80+
assert!(ws.has_no_diagnostic_in_namespace(
8181
DiagnosticCode::ReturnTypeMismatch,
8282
r#"
8383
---@class D31

crates/emmylua_code_analysis/src/compilation/test/decl_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ mod test {
4141
#[test]
4242
fn test_3() {
4343
let mut ws = VirtualWorkspace::new();
44-
assert!(ws.check_code_for(
44+
assert!(ws.has_no_diagnostic(
4545
DiagnosticCode::ParamTypeMismatch,
4646
r#"
4747
---@return any ...

crates/emmylua_code_analysis/src/compilation/test/diagnostic_disable_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod test {
66
fn test_disable_nextline() {
77
let mut ws = VirtualWorkspace::new();
88

9-
assert!(ws.check_code_for(
9+
assert!(ws.has_no_diagnostic(
1010
DiagnosticCode::SyntaxError,
1111
r#"
1212
---@diagnostic disable-next-line: syntax-error

0 commit comments

Comments
 (0)