Skip to content

Commit da0bf00

Browse files
committed
Add a failing roundtrip test for TDCCE
1 parent b12f16a commit da0bf00

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lsp-types/test/JsonSpec.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jsonSpec = do
5151
-- DataTypesJSON
5252
prop "MarkedString" (propertyJsonRoundtrip :: MarkedString -> Property)
5353
prop "MarkupContent" (propertyJsonRoundtrip :: MarkupContent -> Property)
54+
prop "TextDocumentContentChangeEvent" (propertyJsonRoundtrip :: TextDocumentContentChangeEvent -> Property)
5455
prop "WatchedFiles" (propertyJsonRoundtrip :: DidChangeWatchedFilesRegistrationOptions -> Property)
5556
prop "ResponseMessage Hover"
5657
(propertyJsonRoundtrip :: TResponseMessage 'Method_TextDocumentHover -> Property)
@@ -96,6 +97,7 @@ instance Arbitrary Null where
9697

9798
instance (R.AllUniqueLabels r, R.Forall r Arbitrary) => Arbitrary (R.Rec r) where
9899
arbitrary = R.fromLabelsA @Arbitrary $ \_l -> arbitrary
100+
shrink record = R.traverse @Arbitrary @[] shrink record
99101

100102
deriving newtype instance Arbitrary MarkedString
101103

@@ -124,6 +126,7 @@ deriving newtype instance Arbitrary GlobPattern
124126

125127
instance Arbitrary Position where
126128
arbitrary = Position <$> arbitrary <*> arbitrary
129+
shrink (Position s e) = [ Position s' e' | s' <- shrink s, e' <- shrink e ]
127130

128131
instance Arbitrary Location where
129132
arbitrary = Location <$> arbitrary <*> arbitrary
@@ -182,3 +185,6 @@ instance Arbitrary WatchKind where
182185
arbitrary = oneof [pure WatchKind_Change, pure WatchKind_Create, pure WatchKind_Delete]
183186

184187
-- ---------------------------------------------------------------------
188+
--
189+
instance Arbitrary TextDocumentContentChangeEvent where
190+
arbitrary = TextDocumentContentChangeEvent <$> arbitrary

0 commit comments

Comments
 (0)