File: Compiler.hs

package info (click to toggle)
haskell-glob 0.7.5-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 192 kB
  • sloc: haskell: 1,193; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 591 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- File created: 2009-01-30 13:26:51

module Tests.Compiler (tests) where

import Test.Framework
import Test.Framework.Providers.QuickCheck

import System.FilePath.Glob.Base (tryCompileWith, compile, decompile)

import Tests.Base

tests = testGroup "Compiler"
   [ testProperty "compile-decompile-1" prop_compileDecompile1
   ]

-- compile . decompile should be the identity function
prop_compileDecompile1 o s =
   let opt   = unCOpts o
       epat1 = tryCompileWith opt (unPS s)
       pat1  = fromRight epat1
       pat2  = compile . decompile $ pat1
    in isRight epat1 && pat1 == pat2