@@ -35,3 +35,81 @@ spec = do
3535 destructTest " a" 7 17 " LayoutSplitPattern"
3636 destructTest " a" 8 26 " LayoutSplitPatSyn"
3737
38+ describe " providers" $ do
39+ mkTest
40+ " Produces destruct and homomorphism code actions"
41+ " T2" 2 21
42+ [ (id , Destruct , " eab" )
43+ , (id , Homomorphism , " eab" )
44+ , (not , DestructPun , " eab" )
45+ ]
46+
47+ mkTest
48+ " Won't suggest homomorphism on the wrong type"
49+ " T2" 8 8
50+ [ (not , Homomorphism , " global" )
51+ ]
52+
53+ mkTest
54+ " Produces (homomorphic) lambdacase code actions"
55+ " T3" 4 24
56+ [ (id , HomomorphismLambdaCase , " " )
57+ , (id , DestructLambdaCase , " " )
58+ ]
59+
60+ mkTest
61+ " Produces lambdacase code actions"
62+ " T3" 7 13
63+ [ (id , DestructLambdaCase , " " )
64+ ]
65+
66+ mkTest
67+ " Doesn't suggest lambdacase without -XLambdaCase"
68+ " T2" 11 25
69+ [ (not , DestructLambdaCase , " " )
70+ ]
71+
72+ mkTest
73+ " Doesn't suggest destruct if already destructed"
74+ " ProvideAlreadyDestructed" 6 18
75+ [ (not , Destruct , " x" )
76+ ]
77+
78+ mkTest
79+ " ...but does suggest destruct if destructed in a different branch"
80+ " ProvideAlreadyDestructed" 9 7
81+ [ (id , Destruct , " x" )
82+ ]
83+
84+ mkTest
85+ " Doesn't suggest destruct on class methods"
86+ " ProvideLocalHyOnly" 2 12
87+ [ (not , Destruct , " mempty" )
88+ ]
89+
90+ mkTest
91+ " Suggests homomorphism if the domain is bigger than the codomain"
92+ " ProviderHomomorphism" 12 13
93+ [ (id , Homomorphism , " g" )
94+ ]
95+
96+ mkTest
97+ " Doesn't suggest homomorphism if the domain is smaller than the codomain"
98+ " ProviderHomomorphism" 15 14
99+ [ (not , Homomorphism , " g" )
100+ , (id , Destruct , " g" )
101+ ]
102+
103+ mkTest
104+ " Suggests lambda homomorphism if the domain is bigger than the codomain"
105+ " ProviderHomomorphism" 18 14
106+ [ (id , HomomorphismLambdaCase , " " )
107+ ]
108+
109+ mkTest
110+ " Doesn't suggest lambda homomorphism if the domain is smaller than the codomain"
111+ " ProviderHomomorphism" 21 15
112+ [ (not , HomomorphismLambdaCase , " " )
113+ , (id , DestructLambdaCase , " " )
114+ ]
115+
0 commit comments