Move enum and negate tests into UnitTests. Update .cabal.

This commit is contained in:
Robbie Gleichman 2016-12-14 00:30:03 -08:00
parent 5d5074cced
commit f2fd136ac9
3 changed files with 54 additions and 24 deletions

View File

@ -2,12 +2,12 @@ name: glance
version: 0.1.0.0
synopsis: Glance is a visual Haskell
description: Please see README.md
homepage: http://github.com/githubuser/glance#readme
license: Apache-2.0
homepage: https://github.com/rgleichman/glance#readme
license: GPL-3
license-file: LICENSE
author: Robbie Gleichman
maintainer: rgleichman@gmail.com
copyright: 2015 Robbie Gleichman
copyright: 2016 Robbie Gleichman
category: Visual Programming
build-type: Simple
-- extra-source-files:

View File

@ -122,8 +122,8 @@ collapseUnitTests = TestList[
-- Translate unit tests
dollarTests :: Test
dollarTests = TestList [
applyTests :: Test
applyTests = TestList [
TestLabel "dollarTests1" $ assertEqualSyntaxGraphs [
"y = f x",
"y = f $ x"
@ -140,6 +140,11 @@ dollarTests = TestList [
"y = f 1 (g 2)",
"y = f 1 $ g 2"
]
,
assertEqualSyntaxGraphs [
"y = f 3 4",
"y = (f 3) 4"
]
]
composeApplyTests :: Test
@ -243,6 +248,47 @@ letTests = TestList [
-- ]
]
negateTests :: Test
negateTests = TestList [
assertEqualSyntaxGraphs [
"y = negate 1",
"y = -1"
]
,
assertEqualSyntaxGraphs [
"y = negate ((/) 1 2)",
"y = -1/2"
]
,
assertEqualSyntaxGraphs [
"y = negate x",
"y = -x"
]
]
enumTests :: Test
enumTests = TestList [
assertEqualSyntaxGraphs [
"y = enumFrom 1",
"y = [1..]"
]
,
assertEqualSyntaxGraphs [
"y = enumFromThen 1 2",
"y = [1,2..]"
]
,
assertEqualSyntaxGraphs [
"y = enumFromTo 0 10",
"y = [0..10]"
]
,
assertEqualSyntaxGraphs [
"y = enumFromThenTo 0 1 10",
"y = [0,1..10]"
]
]
-- Yes, the commas get their own line
translateUnitTests :: Test
translateUnitTests = TestList [
@ -251,12 +297,14 @@ translateUnitTests = TestList [
"y = f <$> x"
]
,
TestLabel "dollarTests" dollarTests
TestLabel "applyTests" applyTests
,
TestLabel "composeApplyTests" composeApplyTests
,
TestLabel "infixTests" infixTests
, TestLabel "letTests" letTests
, TestLabel "negateTests" negateTests
, TestLabel "enumTests" enumTests
]
allUnitTests :: Test

View File

@ -49,7 +49,6 @@ nestedTests = [
"y = f [1,2]",
"y = f [g 3, h 5]",
"y = f $ g (\\x -> x)",
"y = (f 3) 4",
"y = f y",
"y = f (g y)",
"y = f1 (f2 ( f3 (f4 2))) 1", -- test compose embedded in apply
@ -78,13 +77,6 @@ specialTests = [
"yyyyy = fffff xxxxx"
]
negateTests :: [String]
negateTests = [
"y = -1",
"y = -1/2",
"y = -x"
]
doTests :: [String]
doTests = [
"y = do {x1}",
@ -96,14 +88,6 @@ doTests = [
"y = do {let {x = 1}; x2 <- x; f x2}"
]
enumTests :: [String]
enumTests = [
"y = [1..]",
"y = [1,2..]",
"y = [0..10]",
"y = [0,1..10]"
]
tupleTests :: [String]
tupleTests = [
"y = ()",
@ -235,9 +219,7 @@ testDecls :: [String]
testDecls = mconcat [
composeTests
,nestedTests
,negateTests
,doTests
,enumTests
,caseTests
,lambdaTests
,guardTests