Permalink
Browse files

Add test case. Checks whether error messages are properly removed, when

fixing an error.
  • Loading branch information...
1 parent c6736be commit 8d137deacfbd8d1aa6dfbda0fe48733f46247395 @nominolo nominolo committed Mar 13, 2009
Showing with 43 additions and 0 deletions.
  1. +29 −0 tests/update-err-msg/Main.hs
  2. +11 −0 tests/update-err-msg/Makefile
  3. +3 −0 tests/update-err-msg/expected.stdout
@@ -0,0 +1,29 @@
+import Scion
+import Scion.Types
+import Scion.Types.Notes
+import Scion.Server.Protocol
+import Scion.Server.Commands
+import qualified Data.MultiSet as MS
+import System.Directory ( removeFile )
+import GHC.Conc
+
+main =
+ runScion $ do
+-- setGHCVerbosity 5
+-- setVerbosity deafening
+ io $ writeFile test_file "main = return ()"
+ io $ threadDelay 1000000
+ rslt <- loadComponent (File test_file)
+ io $ print (MS.size (compilationNotes rslt))
+ io $ writeFile test_file "main = return -4"
+ io $ threadDelay 1000000
+ (ok, rslt') <- backgroundTypecheckFile test_file
+ io $ print (ok, MS.size (compilationNotes rslt'))
+ io $ writeFile test_file "main = print () >> return ()"
+ io $ threadDelay 1000000
+ (ok', rslt'') <- backgroundTypecheckFile test_file
+ io $ print (ok', MS.size (compilationNotes rslt''))
+ io $ removeFile test_file
+
+io = liftIO
+test_file = "./test.hs"
@@ -0,0 +1,11 @@
+test: Main.hs
+ @ghc --make Main.hs -o $@
+
+run: test
+ ./test > run.stdout
+ @diff -u run.stdout expected.stdout
+
+.PHONY: clean
+
+clean:
+ @rm -rf *.o *.hi test run.stdout
@@ -0,0 +1,3 @@
+0
+(True,1)
+(True,0)

0 comments on commit 8d137de

Please sign in to comment.