tasty-sugar 1.0.1.0 → 1.0.1.1
raw patch · 7 files changed
+134/−7 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- src/internal/Test/Tasty/Sugar/Analysis.hs +16/−0
- tasty-sugar.cabal +1/−1
- test/Sample1.hs +5/−0
- test/TestMultiAssoc.hs +37/−2
- test/TestNoAssoc.hs +33/−2
- test/TestSingleAssoc.hs +37/−2
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision history for tasty-sugar +## 1.0.1.1 -- 2021-01-18++ * Fix error where an expected set of matches could match multiple+ root names where the root names contain separators.+ ## 1.0.1.0 -- 2021-01-18 * Associated files are now ranked based on the number of parameter
src/internal/Test/Tasty/Sugar/Analysis.hs view
@@ -47,7 +47,23 @@ let seps = separators pat params = validParams pat combineExpRes (swts, expl) = bimap (swts :) (expl :)++ trimSweets :: [(Sweets, SweetExplanation)] ->+ [(Sweets, SweetExplanation)]+ trimSweets =+ -- If multiple Sweets have the same rootMatchName, use the one+ -- with the longer rootBaseName. This prevents "foo.exp" and+ -- "foo-bar.exp" from both matching "foo-bar.c".+ (\l -> let removeShorterBases lst (entry,_) =+ let notShorterBase (s,_) = not $+ and [ rootMatchName s == rootMatchName entry+ , rootBaseName s < rootBaseName entry+ ]+ in filter notShorterBase lst+ in foldl removeShorterBases l l)+ in foldr combineExpRes ([], []) $+ trimSweets $ catMaybes $ fmap (findExpectation pat rootNm allNames) $ observeAll $
tasty-sugar.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.0 name: tasty-sugar-version: 1.0.1.0+version: 1.0.1.1 synopsis: Tests defined by Search Using Golden Answer References description: .
test/Sample1.hs view
@@ -24,6 +24,11 @@ looping.ppc.expected looping.x86.exe looping.x86.expected+looping-around.c+looping-around.ppc.exe+looping-around.ppc.expected+looping-around.x86.exe+looping-around.expected Makefile README.org switching
test/TestMultiAssoc.hs view
@@ -38,9 +38,9 @@ -- This is simply the number of entries in sample1; if this -- fails in means that sample1 has been changed and the other -- tests here are likely to need updating.- testCase "valid sample" $ 53 @=? length sample1+ testCase "valid sample" $ 58 @=? length sample1 - , sugarTestEq "correct found count" sugarCube sample1 5 length+ , sugarTestEq "correct found count" sugarCube sample1 6 length , testCase "results" $ compareBags "results" sugar1 $ let p = (testInpPath </>) in@@ -158,6 +158,41 @@ , expParamsMatch = [ ("arch" , Explicit "ppc") , ("form" , Assumed "refined") ] , associated = [ ("exe", p "looping.ppc.exe")+ ]+ }+ ]+ }+ , Sweets { rootMatchName = "looping-around.c"+ , rootBaseName = "looping-around"+ , rootFile = p "looping-around.c"+ , cubeParams = validParams sugarCube+ , expected =+ [ Expectation+ { expectedFile = p "looping-around.expected"+ , expParamsMatch = [ ("arch", Assumed "x86")+ , ("form", Assumed "base") ]+ , associated = [ ("exe", p "looping-around.x86.exe")+ ]+ }+ , Expectation+ { expectedFile = p "looping-around.expected"+ , expParamsMatch = [ ("arch", Assumed "x86")+ , ("form", Assumed "refined")]+ , associated = [ ("exe", p "looping-around.x86.exe")+ ]+ }+ , Expectation+ { expectedFile = p "looping-around.ppc.expected"+ , expParamsMatch = [ ("arch" , Explicit "ppc")+ , ("form" , Assumed "base") ]+ , associated = [ ("exe", p "looping-around.ppc.exe")+ ]+ }+ , Expectation+ { expectedFile = p "looping-around.ppc.expected"+ , expParamsMatch = [ ("arch" , Explicit "ppc")+ , ("form" , Assumed "refined") ]+ , associated = [ ("exe", p "looping-around.ppc.exe") ] } ]
test/TestNoAssoc.hs view
@@ -31,9 +31,9 @@ -- This is simply the number of entries in sample1; if this -- fails in means that sample1 has been changed and the other -- tests here are likely to need updating.- testCase "valid sample" $ 53 @=? length sample1+ testCase "valid sample" $ 58 @=? length sample1 - , sugarTestEq "correct found count" sugarCube sample1 5 length+ , sugarTestEq "correct found count" sugarCube sample1 6 length , testCase "results" $ compareBags "results" sugar1 $ let p = (testInpPath </>) in@@ -127,6 +127,37 @@ } , Expectation { expectedFile = p "looping.ppc.expected"+ , expParamsMatch = [ ("arch" , Explicit "ppc")+ , ("form" , Assumed "refined") ]+ , associated = []+ }+ ]+ }+ , Sweets { rootMatchName = "looping-around.c"+ , rootBaseName = "looping-around"+ , rootFile = p "looping-around.c"+ , cubeParams = validParams sugarCube+ , expected =+ [ Expectation+ { expectedFile = p "looping-around.expected"+ , expParamsMatch = [ ("arch", Assumed "x86")+ , ("form", Assumed "base") ]+ , associated = []+ }+ , Expectation+ { expectedFile = p "looping-around.expected"+ , expParamsMatch = [ ("arch", Assumed "x86")+ , ("form", Assumed "refined")]+ , associated = []+ }+ , Expectation+ { expectedFile = p "looping-around.ppc.expected"+ , expParamsMatch = [ ("arch" , Explicit "ppc")+ , ("form" , Assumed "base") ]+ , associated = []+ }+ , Expectation+ { expectedFile = p "looping-around.ppc.expected" , expParamsMatch = [ ("arch" , Explicit "ppc") , ("form" , Assumed "refined") ] , associated = []
test/TestSingleAssoc.hs view
@@ -32,9 +32,9 @@ -- This is simply the number of entries in sample1; if this -- fails in means that sample1 has been changed and the other -- tests here are likely to need updating.- testCase "valid sample" $ 53 @=? length sample1+ testCase "valid sample" $ 58 @=? length sample1 - , sugarTestEq "correct found count" sugarCube sample1 5 length+ , sugarTestEq "correct found count" sugarCube sample1 6 length , testCase "results" $ compareBags "results" sugar1 $ let p = (testInpPath </>) in@@ -142,6 +142,41 @@ , expParamsMatch = [ ("arch" , Explicit "ppc") , ("form" , Assumed "refined") ] , associated = [ ("exe", p "looping.ppc.exe")+ ]+ }+ ]+ }+ , Sweets { rootMatchName = "looping-around.c"+ , rootBaseName = "looping-around"+ , rootFile = p "looping-around.c"+ , cubeParams = validParams sugarCube+ , expected =+ [ Expectation+ { expectedFile = p "looping-around.expected"+ , expParamsMatch = [ ("arch", Assumed "x86")+ , ("form", Assumed "base") ]+ , associated = [ ("exe", p "looping-around.x86.exe")+ ]+ }+ , Expectation+ { expectedFile = p "looping-around.expected"+ , expParamsMatch = [ ("arch", Assumed "x86")+ , ("form", Assumed "refined")]+ , associated = [ ("exe", p "looping-around.x86.exe")+ ]+ }+ , Expectation+ { expectedFile = p "looping-around.ppc.expected"+ , expParamsMatch = [ ("arch" , Explicit "ppc")+ , ("form" , Assumed "base") ]+ , associated = [ ("exe", p "looping-around.ppc.exe")+ ]+ }+ , Expectation+ { expectedFile = p "looping-around.ppc.expected"+ , expParamsMatch = [ ("arch" , Explicit "ppc")+ , ("form" , Assumed "refined") ]+ , associated = [ ("exe", p "looping-around.ppc.exe") ] } ]