@@ -19,10 +19,46 @@ limitations under the License.
19
19
-- Copyright: Copyright 2025 Google LLC
20
20
-- License: Apache-2.0
21
21
22
- module SpecialOutputSpec ( spec ) where
22
+ module SpecialOutputSpec where
23
23
24
+ import Data.Aeson
25
+ import Data.Aeson.KeyMap qualified as KeyMap
26
+ import Data.Vector qualified as Vector
27
+ import SpecialOutput
28
+ import System.Exit
24
29
import Test.Hspec
25
30
26
31
spec :: Spec
27
32
spec = parallel $ do
28
- it " is pending" pending
33
+ it " outputs minimal annotation" $
34
+ let v = encode $ Object $ KeyMap. singleton " runs" runs
35
+ runs = Array $ Vector. singleton run
36
+ run = Object $ KeyMap. singleton " results" results
37
+ results = Array $ Vector. singleton result
38
+ result =
39
+ Object $
40
+ KeyMap. fromList
41
+ [ (" level" , " error" ),
42
+ (" ruleId" , " redundant entity" ),
43
+ (" message" , Object $ KeyMap. singleton " text" " random comment" )
44
+ ]
45
+ in output Never v `shouldBe` (" ::error title=redundant entity::random comment\n " , ExitSuccess )
46
+
47
+ it " outputs annotation with some location information" $
48
+ let v = encode $ Object $ KeyMap. singleton " runs" runs
49
+ runs = Array $ Vector. singleton run
50
+ run = Object $ KeyMap. singleton " results" results
51
+ results = Array $ Vector. singleton result
52
+ result =
53
+ Object $
54
+ KeyMap. fromList
55
+ [ (" level" , " error" ),
56
+ (" ruleId" , " redundant entity" ),
57
+ (" message" , Object $ KeyMap. singleton " text" " random comment" ),
58
+ (" locations" , Array $ Vector. singleton location)
59
+ ]
60
+ location = Object $ KeyMap. singleton " physicalLocation" physicalLocation
61
+ physicalLocation = Object $ KeyMap. singleton " artifactLocation" artifactLocation
62
+ artifactLocation = Object $ KeyMap. singleton " uri" " SpecialOutput.hs"
63
+ in output Never v
64
+ `shouldBe` (" ::error file=SpecialOutput.hs,title=redundant entity::random comment\n " , ExitSuccess )
0 commit comments