on master help sign in
updating tests to compile against 2.1.0.3
0caf032coreyoconnor
test/Makefile+1−1
@@ -26,7 +26,7 @@ $(VERIF_TESTS)
26$(shell mkdir -p objects )
26$(shell mkdir -p objects )
27
27
28# TODO: Tests should also be buildable referencing the currently installed vty
28# TODO: Tests should also be buildable referencing the currently installed vty
29−GHC_ARGS=--make -i../src -package parallel -package deepseq-1.1.0.0 -hide-package transformers -hide-package monads-fd -hide-package monads-tf -package QuickCheck-2.1.0.2 -ignore-package vty ../cbits/gwinsz.c ../cbits/output_buffer.c ../cbits/set_term_timing.c ../cbits/mk_wcwidth.c -O -funbox-strict-fields -Wall -threaded -fno-full-laziness -fspec-constr -odir objects -hidir objects
29+GHC_ARGS=--make -i../src -package parallel -package deepseq-1.1.0.0 -hide-package transformers -hide-package monads-fd -hide-package monads-tf -package QuickCheck-2.1.0.3 -ignore-package vty ../cbits/gwinsz.c ../cbits/output_buffer.c ../cbits/set_term_timing.c ../cbits/mk_wcwidth.c -O -funbox-strict-fields -Wall -threaded -fno-full-laziness -fspec-constr -odir objects -hidir objects
30
30
31GHC_PROF_ARGS=-prof -auto-all $(GHC_ARGS)
31GHC_PROF_ARGS=-prof -auto-all $(GHC_ARGS)
32
32
test/Verify.hs+1
@@ -7,6 +7,7 @@ module Verify ( module Verify
7 , module Test.QuickCheck
7 , module Test.QuickCheck
8 , succeeded
8 , succeeded
9 , failed
9 , failed
10+ , result
10 , Result(..)
11 , Result(..)
11 , monadicIO
12 , monadicIO
12 , liftIO
13 , liftIO
test/Verify/Data/Terminfo/Parse.hs+1−1
@@ -111,7 +111,7 @@ verify_bytes_equal :: [Word8] -> [Word8] -> Result
111verify_bytes_equal out_bytes expected_bytes
111verify_bytes_equal out_bytes expected_bytes
112 = if out_bytes == expected_bytes
112 = if out_bytes == expected_bytes
113 then succeeded
113 then succeeded
114− else failed
114+ else failed $ result
115 { reason = "out_bytes ["
115 { reason = "out_bytes ["
116 ++ hex_dump out_bytes
116 ++ hex_dump out_bytes
117 ++ "] /= expected_bytes ["
117 ++ "] /= expected_bytes ["
test/Verify/Graphics/Vty/Span.hs+7−7
@@ -20,10 +20,10 @@ is_attr_span_op _ = False
20verify_all_spans_have_width i spans w
20verify_all_spans_have_width i spans w
21 = case all_spans_have_width spans w of
21 = case all_spans_have_width spans w of
22 True -> succeeded
22 True -> succeeded
23− False -> failed { reason = "Not all spans contained operations defining exactly "
23+ False -> failed $ result { reason = "Not all spans contained operations defining exactly "
24− ++ show w
24+ ++ show w
25− ++ " columns of output -\n"
25+ ++ " columns of output -\n"
26− ++ show i
26+ ++ show i
27− ++ "\n->\n"
27+ ++ "\n->\n"
28− ++ show spans
28+ ++ show spans
29− }
29+ }
test/verify_debug_terminal.hs+4−4
@@ -50,7 +50,7 @@ single_T_row (DebugWindow w h) = liftIOResult $ do
50 ++ concat (replicate (fromEnum h - 1) $ "MA" ++ replicate (fromEnum w) 'B')
50 ++ concat (replicate (fromEnum h - 1) $ "MA" ++ replicate (fromEnum w) 'B')
51 expected_bytes :: BS.ByteString = UTF8.toRep $ UTF8.fromString expected
51 expected_bytes :: BS.ByteString = UTF8.toRep $ UTF8.fromString expected
52 if out_bytes /= expected_bytes
52 if out_bytes /= expected_bytes
53− then return $ failed { reason = "\n" ++ show out_bytes ++ "\n\n" ++ show expected_bytes }
53+ then return $ failed $ result { reason = "\n" ++ show out_bytes ++ "\n\n" ++ show expected_bytes }
54 else return succeeded
54 else return succeeded
55
55
56many_T_rows :: DebugWindow -> Property
56many_T_rows :: DebugWindow -> Property
@@ -67,7 +67,7 @@ many_T_rows (DebugWindow w h) = liftIOResult $ do
67 let expected = "HD" ++ concat (replicate (fromEnum h) $ "MA" ++ replicate (fromEnum w) 'T')
67 let expected = "HD" ++ concat (replicate (fromEnum h) $ "MA" ++ replicate (fromEnum w) 'T')
68 expected_bytes :: BS.ByteString = UTF8.toRep $ UTF8.fromString expected
68 expected_bytes :: BS.ByteString = UTF8.toRep $ UTF8.fromString expected
69 if out_bytes /= expected_bytes
69 if out_bytes /= expected_bytes
70− then return $ failed { reason = "\n" ++ show out_bytes ++ "\n\n" ++ show expected_bytes }
70+ then return $ failed $ result { reason = "\n" ++ show out_bytes ++ "\n\n" ++ show expected_bytes }
71 else return succeeded
71 else return succeeded
72
72
73many_T_rows_cropped_width :: DebugWindow -> Property
73many_T_rows_cropped_width :: DebugWindow -> Property
@@ -84,7 +84,7 @@ many_T_rows_cropped_width (DebugWindow w h) = liftIOResult $ do
84 let expected = "HD" ++ concat (replicate (fromEnum h) $ "MA" ++ replicate (fromEnum w) 'T')
84 let expected = "HD" ++ concat (replicate (fromEnum h) $ "MA" ++ replicate (fromEnum w) 'T')
85 expected_bytes :: BS.ByteString = UTF8.toRep $ UTF8.fromString expected
85 expected_bytes :: BS.ByteString = UTF8.toRep $ UTF8.fromString expected
86 if out_bytes /= expected_bytes
86 if out_bytes /= expected_bytes
87− then return $ failed { reason = "\n" ++ show out_bytes ++ "\n\n" ++ show expected_bytes }
87+ then return $ failed $ result { reason = "\n" ++ show out_bytes ++ "\n\n" ++ show expected_bytes }
88 else return succeeded
88 else return succeeded
89
89
90many_T_rows_cropped_height :: DebugWindow -> Property
90many_T_rows_cropped_height :: DebugWindow -> Property
@@ -101,7 +101,7 @@ many_T_rows_cropped_height (DebugWindow w h) = liftIOResult $ do
101 let expected = "HD" ++ concat (replicate (fromEnum h) $ "MA" ++ replicate (fromEnum w) 'T')
101 let expected = "HD" ++ concat (replicate (fromEnum h) $ "MA" ++ replicate (fromEnum w) 'T')
102 expected_bytes :: BS.ByteString = UTF8.toRep $ UTF8.fromString expected
102 expected_bytes :: BS.ByteString = UTF8.toRep $ UTF8.fromString expected
103 if out_bytes /= expected_bytes
103 if out_bytes /= expected_bytes
104− then return $ failed { reason = "\n" ++ show out_bytes ++ "\n\n" ++ show expected_bytes }
104+ then return $ failed $ result { reason = "\n" ++ show out_bytes ++ "\n\n" ++ show expected_bytes }
105 else return succeeded
105 else return succeeded
106
106
107main = run_test $ do
107main = run_test $ do
test/verify_eval_terminfo_caps.hs+6−5
@@ -104,7 +104,8 @@ main = do
104 parse_result <- parse_cap_expression cap_def
104 parse_result <- parse_cap_expression cap_def
105 let test_name = "\teval cap " ++ cap_name ++ " -> " ++ show cap_def
105 let test_name = "\teval cap " ++ cap_name ++ " -> " ++ show cap_def
106 _ <- case parse_result of
106 _ <- case parse_result of
107− Left error -> verify test_name ( liftResult $ failed { reason = "prase error " ++ show error } )
107+ Left error -> verify test_name ( liftResult $ failed
108+ $ result { reason = "prase error " ++ show error } )
108 Right !cap_expr -> verify test_name ( verify_eval_cap eval_buffer cap_expr )
109 Right !cap_expr -> verify test_name ( verify_eval_cap eval_buffer cap_expr )
109 return ()
110 return ()
110 Nothing -> do
111 Nothing -> do
@@ -123,11 +124,11 @@ verify_eval_cap eval_buffer expr !junk_int = do
123 end_ptr <- serialize_cap_expression expr input_values start_ptr
124 end_ptr <- serialize_cap_expression expr input_values start_ptr
124 case end_ptr `minusPtr` start_ptr of
125 case end_ptr `minusPtr` start_ptr of
125 count | count < 0 ->
126 count | count < 0 ->
126− return $ failed { reason = "End pointer before start pointer." }
127+ return $ failed $ result { reason = "End pointer before start pointer." }
127 | toEnum count > byte_count ->
128 | toEnum count > byte_count ->
128− return $ failed { reason = "End pointer past end of buffer by "
129+ return $ failed $ result { reason = "End pointer past end of buffer by "
129− ++ show (toEnum count - byte_count)
130+ ++ show (toEnum count - byte_count)
130− }
131+ }
131 | otherwise ->
132 | otherwise ->
132 return succeeded
133 return succeeded
133
134
test/verify_parse_terminfo_caps.hs+3−3
@@ -111,7 +111,7 @@ main = do
111verify_parse_cap cap_string on_parse = liftIOResult $ do
111verify_parse_cap cap_string on_parse = liftIOResult $ do
112 parse_result <- parse_cap_expression cap_string
112 parse_result <- parse_cap_expression cap_string
113 case parse_result of
113 case parse_result of
114− Left error -> return $ failed { reason = "parse error " ++ show error }
114+ Left error -> return $ failed $ result { reason = "parse error " ++ show error }
115 Right e -> on_parse e
115 Right e -> on_parse e
116
116
117non_paramaterized_caps (NonParamCapString cap) = do
117non_paramaterized_caps (NonParamCapString cap) = do
@@ -140,7 +140,7 @@ push_param_caps (PushParamCap cap_string expected_param_count expected_bytes) =
140 out_param_count = param_count e
140 out_param_count = param_count e
141 in return $ if out_param_count == expected_param_count
141 in return $ if out_param_count == expected_param_count
142 then verify_bytes_equal out_bytes expected_bytes
142 then verify_bytes_equal out_bytes expected_bytes
143− else failed { reason = "out param count /= expected param count" }
143+ else failed $ result { reason = "out param count /= expected param count" }
144
144
145dec_print_param_caps (DecPrintCap cap_string expected_param_count expected_bytes) = do
145dec_print_param_caps (DecPrintCap cap_string expected_param_count expected_bytes) = do
146 verify_parse_cap cap_string $ \e ->
146 verify_parse_cap cap_string $ \e ->
@@ -149,7 +149,7 @@ dec_print_param_caps (DecPrintCap cap_string expected_param_count expected_bytes
149 out_param_count = param_count e
149 out_param_count = param_count e
150 in return $ if out_param_count == expected_param_count
150 in return $ if out_param_count == expected_param_count
151 then verify_bytes_equal out_bytes expected_bytes
151 then verify_bytes_equal out_bytes expected_bytes
152− else failed { reason = "out param count /= expected param count" }
152+ else failed $ result { reason = "out param count /= expected param count" }
153
153
154print_cap ti cap_name = do
154print_cap ti cap_name = do
155 putStrLn $ cap_name ++ ": " ++ show (from_capname ti cap_name)
155 putStrLn $ cap_name ++ ": " ++ show (from_capname ti cap_name)