Skip to content

Commit 70813d1

Browse files
committed
tests: use distinct file for each field
1 parent 791eb8c commit 70813d1

File tree

421 files changed

+24047
-45932
lines changed

Some content is hidden

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

421 files changed

+24047
-45932
lines changed

Cabal-tests/tests/ParserTests.hs

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -244,25 +244,29 @@ formatGoldenTest fp = cabalGoldenTest "format" correct $ do
244244

245245
#ifdef MIN_VERSION_tree_diff
246246
treeDiffGoldenTest :: FilePath -> TestTree
247-
treeDiffGoldenTest fp = ediffGolden goldenTest "expr" exprFile $ do
248-
contents <- BS.readFile input
249-
let res = withSource (PCabalFile (fp, contents)) $ parseGenericPackageDescription contents
250-
let (_, x) = runParseResult res
251-
case x of
252-
Right gpd -> pure $ toExpr
253-
( gpd
254-
-- Test accessors because they encapsulate the merging behaviour
255-
, condLibrary gpd
256-
, condSubLibraries gpd
257-
, condForeignLibs gpd
258-
, condExecutables gpd
259-
, condTestSuites gpd
260-
, condBenchmarks gpd
261-
)
262-
Left (_, errs) -> fail $ unlines $ "ERROR" : map (showPErrorWithSource . fmap renderCabalFileSource) (NE.toList errs)
263-
where
264-
input = "tests" </> "ParserTests" </> "regressions" </> fp
265-
exprFile = replaceExtension input "expr"
247+
treeDiffGoldenTest fp =
248+
let go label f = ediffGolden goldenTest label exprFile $ do
249+
contents <- BS.readFile input
250+
let res = withSource (PCabalFile (fp, contents)) $ parseGenericPackageDescription contents
251+
let (_, x) = runParseResult res
252+
case x of
253+
Right gpd -> pure (toExpr $ f gpd)
254+
Left (_, errs) -> fail $ unlines $ "ERROR" : map (showPErrorWithSource . fmap renderCabalFileSource) (NE.toList errs)
255+
where
256+
input = "tests" </> "ParserTests" </> "regressions" </> fp
257+
exprFile = replaceExtension input (label <> ".expr")
258+
in testGroup "expr"
259+
[ go "packageDescription" packageDescription
260+
, go "gpdScannedVersion" gpdScannedVersion
261+
, go "genPackageFlags" genPackageFlags
262+
-- Test accessors because they encapsulate the merging behaviour
263+
, go "condLibrary" condLibrary
264+
, go "condSubLibraries" condSubLibraries
265+
, go "condForeignLibs" condForeignLibs
266+
, go "condExecutables" condExecutables
267+
, go "condTestSuites" condTestSuites
268+
, go "condBenchmarks" condBenchmarks
269+
]
266270
#endif
267271

268272
formatRoundTripTest :: FilePath -> TestTree
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
Just
2+
CondNode {
3+
condTreeData = Library {
4+
libName = LMainLibName,
5+
exposedModules = [
6+
ModuleName "Data.Octree"],
7+
reexportedModules = [],
8+
signatures = [],
9+
libExposed = True,
10+
libVisibility =
11+
LibraryVisibilityPublic,
12+
libBuildInfo = BuildInfo {
13+
buildable = True,
14+
buildTools = [],
15+
buildToolDepends = [],
16+
cppOptions = [],
17+
asmOptions = [],
18+
cmmOptions = [],
19+
ccOptions = [],
20+
cxxOptions = [],
21+
jsppOptions = [],
22+
ldOptions = [],
23+
hsc2hsOptions = [],
24+
pkgconfigDepends = [],
25+
frameworks = [],
26+
extraFrameworkDirs = [],
27+
asmSources = [],
28+
cmmSources = [],
29+
cSources = [],
30+
cxxSources = [],
31+
jsSources = [],
32+
hsSourceDirs = [],
33+
otherModules = [
34+
ModuleName
35+
"Data.Octree.Internal"],
36+
virtualModules = [],
37+
autogenModules = [],
38+
defaultLanguage = Nothing,
39+
otherLanguages = [],
40+
defaultExtensions = [],
41+
otherExtensions = [],
42+
oldExtensions = [
43+
EnableExtension
44+
ScopedTypeVariables],
45+
extraLibs = [],
46+
extraLibsStatic = [],
47+
extraGHCiLibs = [],
48+
extraBundledLibs = [],
49+
extraLibFlavours = [],
50+
extraDynLibFlavours = [],
51+
extraLibDirs = [],
52+
extraLibDirsStatic = [],
53+
includeDirs = [],
54+
includes = [],
55+
autogenIncludes = [],
56+
installIncludes = [],
57+
options = PerCompilerFlavor
58+
[]
59+
[],
60+
profOptions = PerCompilerFlavor
61+
[]
62+
[],
63+
sharedOptions =
64+
PerCompilerFlavor [] [],
65+
profSharedOptions =
66+
PerCompilerFlavor [] [],
67+
staticOptions =
68+
PerCompilerFlavor [] [],
69+
customFieldsBI = [],
70+
targetBuildDepends = [
71+
Dependency
72+
(PackageName "base")
73+
(IntersectVersionRanges
74+
(OrLaterVersion
75+
(mkVersion [4, 0]))
76+
(EarlierVersion
77+
(mkVersion [4, 7])))
78+
mainLibSet,
79+
Dependency
80+
(PackageName "AC-Vector")
81+
(OrLaterVersion
82+
(mkVersion [2, 3, 0]))
83+
mainLibSet,
84+
Dependency
85+
(PackageName "QuickCheck")
86+
(OrLaterVersion
87+
(mkVersion [2, 4, 0]))
88+
mainLibSet],
89+
mixins = []}},
90+
condTreeConstraints = [
91+
Dependency
92+
(PackageName "base")
93+
(IntersectVersionRanges
94+
(OrLaterVersion
95+
(mkVersion [4, 0]))
96+
(EarlierVersion
97+
(mkVersion [4, 7])))
98+
mainLibSet,
99+
Dependency
100+
(PackageName "AC-Vector")
101+
(OrLaterVersion
102+
(mkVersion [2, 3, 0]))
103+
mainLibSet,
104+
Dependency
105+
(PackageName "QuickCheck")
106+
(OrLaterVersion
107+
(mkVersion [2, 4, 0]))
108+
mainLibSet],
109+
condTreeComponents = []}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
[
2+
_×_
3+
(UnqualComponentName
4+
"test_Octree")
5+
CondNode {
6+
condTreeData = TestSuite {
7+
testName = UnqualComponentName
8+
"",
9+
testInterface = TestSuiteExeV10
10+
(mkVersion [1, 0])
11+
(SymbolicPath
12+
"tests/test_Octree.hs"),
13+
testBuildInfo = BuildInfo {
14+
buildable = True,
15+
buildTools = [],
16+
buildToolDepends = [],
17+
cppOptions = [],
18+
asmOptions = [],
19+
cmmOptions = [],
20+
ccOptions = [],
21+
cxxOptions = [],
22+
jsppOptions = [],
23+
ldOptions = [],
24+
hsc2hsOptions = [],
25+
pkgconfigDepends = [],
26+
frameworks = [],
27+
extraFrameworkDirs = [],
28+
asmSources = [],
29+
cmmSources = [],
30+
cSources = [],
31+
cxxSources = [],
32+
jsSources = [],
33+
hsSourceDirs = [],
34+
otherModules = [],
35+
virtualModules = [],
36+
autogenModules = [],
37+
defaultLanguage = Nothing,
38+
otherLanguages = [],
39+
defaultExtensions = [],
40+
otherExtensions = [],
41+
oldExtensions = [],
42+
extraLibs = [],
43+
extraLibsStatic = [],
44+
extraGHCiLibs = [],
45+
extraBundledLibs = [],
46+
extraLibFlavours = [],
47+
extraDynLibFlavours = [],
48+
extraLibDirs = [],
49+
extraLibDirsStatic = [],
50+
includeDirs = [],
51+
includes = [],
52+
autogenIncludes = [],
53+
installIncludes = [],
54+
options = PerCompilerFlavor
55+
[]
56+
[],
57+
profOptions = PerCompilerFlavor
58+
[]
59+
[],
60+
sharedOptions =
61+
PerCompilerFlavor [] [],
62+
profSharedOptions =
63+
PerCompilerFlavor [] [],
64+
staticOptions =
65+
PerCompilerFlavor [] [],
66+
customFieldsBI = [],
67+
targetBuildDepends = [
68+
Dependency
69+
(PackageName "base")
70+
(IntersectVersionRanges
71+
(OrLaterVersion
72+
(mkVersion [4, 0]))
73+
(EarlierVersion
74+
(mkVersion [4, 7])))
75+
mainLibSet,
76+
Dependency
77+
(PackageName "AC-Vector")
78+
(OrLaterVersion
79+
(mkVersion [2, 3, 0]))
80+
mainLibSet,
81+
Dependency
82+
(PackageName "QuickCheck")
83+
(OrLaterVersion
84+
(mkVersion [2, 4, 0]))
85+
mainLibSet],
86+
mixins = []},
87+
testCodeGenerators = []},
88+
condTreeConstraints = [
89+
Dependency
90+
(PackageName "base")
91+
(IntersectVersionRanges
92+
(OrLaterVersion
93+
(mkVersion [4, 0]))
94+
(EarlierVersion
95+
(mkVersion [4, 7])))
96+
mainLibSet,
97+
Dependency
98+
(PackageName "AC-Vector")
99+
(OrLaterVersion
100+
(mkVersion [2, 3, 0]))
101+
mainLibSet,
102+
Dependency
103+
(PackageName "QuickCheck")
104+
(OrLaterVersion
105+
(mkVersion [2, 4, 0]))
106+
mainLibSet],
107+
condTreeComponents = []},
108+
_×_
109+
(UnqualComponentName "readme")
110+
CondNode {
111+
condTreeData = TestSuite {
112+
testName = UnqualComponentName
113+
"",
114+
testInterface = TestSuiteExeV10
115+
(mkVersion [1, 0])
116+
(SymbolicPath "README.lhs"),
117+
testBuildInfo = BuildInfo {
118+
buildable = True,
119+
buildTools = [],
120+
buildToolDepends = [],
121+
cppOptions = [],
122+
asmOptions = [],
123+
cmmOptions = [],
124+
ccOptions = [],
125+
cxxOptions = [],
126+
jsppOptions = [],
127+
ldOptions = [],
128+
hsc2hsOptions = [],
129+
pkgconfigDepends = [],
130+
frameworks = [],
131+
extraFrameworkDirs = [],
132+
asmSources = [],
133+
cmmSources = [],
134+
cSources = [],
135+
cxxSources = [],
136+
jsSources = [],
137+
hsSourceDirs = [],
138+
otherModules = [],
139+
virtualModules = [],
140+
autogenModules = [],
141+
defaultLanguage = Nothing,
142+
otherLanguages = [],
143+
defaultExtensions = [],
144+
otherExtensions = [],
145+
oldExtensions = [],
146+
extraLibs = [],
147+
extraLibsStatic = [],
148+
extraGHCiLibs = [],
149+
extraBundledLibs = [],
150+
extraLibFlavours = [],
151+
extraDynLibFlavours = [],
152+
extraLibDirs = [],
153+
extraLibDirsStatic = [],
154+
includeDirs = [],
155+
includes = [],
156+
autogenIncludes = [],
157+
installIncludes = [],
158+
options = PerCompilerFlavor
159+
["-pgmL", "markdown-unlit"]
160+
[],
161+
profOptions = PerCompilerFlavor
162+
[]
163+
[],
164+
sharedOptions =
165+
PerCompilerFlavor [] [],
166+
profSharedOptions =
167+
PerCompilerFlavor [] [],
168+
staticOptions =
169+
PerCompilerFlavor [] [],
170+
customFieldsBI = [],
171+
targetBuildDepends = [
172+
Dependency
173+
(PackageName "base")
174+
(IntersectVersionRanges
175+
(OrLaterVersion
176+
(mkVersion [4, 0]))
177+
(EarlierVersion
178+
(mkVersion [4, 7])))
179+
mainLibSet,
180+
Dependency
181+
(PackageName "AC-Vector")
182+
(OrLaterVersion
183+
(mkVersion [2, 3, 0]))
184+
mainLibSet,
185+
Dependency
186+
(PackageName "QuickCheck")
187+
(OrLaterVersion
188+
(mkVersion [2, 4, 0]))
189+
mainLibSet,
190+
Dependency
191+
(PackageName "markdown-unlit")
192+
(OrLaterVersion (mkVersion [0]))
193+
mainLibSet],
194+
mixins = []},
195+
testCodeGenerators = []},
196+
condTreeConstraints = [
197+
Dependency
198+
(PackageName "base")
199+
(IntersectVersionRanges
200+
(OrLaterVersion
201+
(mkVersion [4, 0]))
202+
(EarlierVersion
203+
(mkVersion [4, 7])))
204+
mainLibSet,
205+
Dependency
206+
(PackageName "AC-Vector")
207+
(OrLaterVersion
208+
(mkVersion [2, 3, 0]))
209+
mainLibSet,
210+
Dependency
211+
(PackageName "QuickCheck")
212+
(OrLaterVersion
213+
(mkVersion [2, 4, 0]))
214+
mainLibSet,
215+
Dependency
216+
(PackageName "markdown-unlit")
217+
(OrLaterVersion (mkVersion [0]))
218+
mainLibSet],
219+
condTreeComponents = []}]

0 commit comments

Comments
 (0)