Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Maed223 committed May 2, 2024
1 parent d3484fb commit 0df7c48
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion internal/command/views/json/diagnostic.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type Diagnostic struct {
Address string `json:"address,omitempty"`
Range *DiagnosticRange `json:"range,omitempty"`
Snippet *DiagnosticSnippet `json:"snippet,omitempty"`
Extra interface{} `json:"extra"`
Extra interface{} `json:"extra,omitempty"`
}

// Pos represents a position in the source code.
Expand Down
4 changes: 4 additions & 0 deletions internal/command/views/json/diagnostic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ func TestNewDiagnostic(t *testing.T) {
},
},
},
Extra: diagnosticCausedBySensitive(true),
},
},
"error with source code subject and expression referring to sensitive value when not caused by sensitive values": {
Expand Down Expand Up @@ -616,6 +617,7 @@ func TestNewDiagnostic(t *testing.T) {
},
},
},
Extra: diagnosticCausedByUnknown(true),
},
},
"error with source code subject and unknown expression of unknown type": {
Expand Down Expand Up @@ -674,6 +676,7 @@ func TestNewDiagnostic(t *testing.T) {
},
},
},
Extra: diagnosticCausedByUnknown(true),
},
},
"error with source code subject and unknown expression of unknown type when not caused by unknown values": {
Expand Down Expand Up @@ -865,6 +868,7 @@ func TestNewDiagnostic(t *testing.T) {
},
},
},
Extra: diagnosticCausedBySensitive(true),
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
"statement": "has a sensitive value"
}
]
}
}
},
"extra": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
"statement": "will be known only after apply"
}
]
}
}
},
"extra": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
"statement": "is a string, known only after apply"
}
]
}
}
},
"extra": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@
"statement": "is object with 2 attributes"
}
]
}
}
},
"extra": true
}
3 changes: 3 additions & 0 deletions internal/configs/module_deprecations.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ type ModuleDeprecationDiagnosticExtra struct {
}

func (i *WorkspaceDeprecationInfo) HasDeprecations() bool {
if i == nil || i.ModuleDeprecationInfos == nil {
return false
}
for _, deprecationInfo := range i.ModuleDeprecationInfos {
if deprecationInfo != nil && deprecationInfo.hasDeprecations() {
return true
Expand Down

0 comments on commit 0df7c48

Please sign in to comment.