@@ -48,7 +48,7 @@ tests = do
4848 liftIO $ putStrLn case_name
4949 return $ case Terminfo.getCapability ti (Terminfo.tiGetStr cap_name) of
5050 Just cap_def -> [verify (case_name ++ " -> " ++ show cap_def)
51− (verify_parse_cap cap_def $ const (return succeeded))]
51+ (verify_parse_cap cap_def $ const succeeded)]
5252 Nothing -> []
5353 )
5454 )
@@ -59,46 +59,36 @@ tests = do
5959 , verify "parse cap string with %pN op" push_param_caps
6060 ] ++ parse_tests
6161
62−verify_parse_cap cap_string on_parse = liftIOResult $ do
63− parse_result <- parse_cap_expression cap_string
64− case parse_result of
65− Left error -> return $ failed { reason = "parse error " ++ show error }
66− Right e -> on_parse e
62+verify_parse_cap cap_string on_parse =
63+ case parse_cap_expression cap_string of
64+ Left error -> failed { reason = "parse error " ++ show error }
65+ Right e -> on_parse e
6766
6867non_paramaterized_caps (NonParamCapString cap) = do
6968 verify_parse_cap cap $ \e ->
70− let expected_count :: Word8 = toEnum $ length cap
71− expected_bytes = map (toEnum . fromEnum) cap
72− out_bytes = bytes_for_range e 0 expected_count
73− in return $ verify_bytes_equal out_bytes expected_bytes
69+ let expected_bytes = map (toEnum . fromEnum) cap
70+ out_bytes = bytes_for_range e 0 (length cap)
71+ in verify_bytes_equal out_bytes expected_bytes
7472
7573literal_percent_caps (LiteralPercentCap cap_string expected_bytes) = do
76− verify_parse_cap cap_string $ \e ->
77− let expected_count :: Word8 = toEnum $ length expected_bytes
78− out_bytes = collect_bytes e
79− in return $ verify_bytes_equal out_bytes expected_bytes
74+ verify_parse_cap cap_string $ \e -> verify_bytes_equal (collect_bytes e) expected_bytes
8075
8176inc_first_two_caps (IncFirstTwoCap cap_string expected_bytes) = do
82− verify_parse_cap cap_string $ \e ->
83− let expected_count :: Word8 = toEnum $ length expected_bytes
84− out_bytes = collect_bytes e
85− in return $ verify_bytes_equal out_bytes expected_bytes
77+ verify_parse_cap cap_string $ \e -> verify_bytes_equal (collect_bytes e) expected_bytes
8678
8779push_param_caps (PushParamCap cap_string expected_param_count expected_bytes) = do
8880 verify_parse_cap cap_string $ \e ->
89− let expected_count :: Word8 = toEnum $ length expected_bytes
90− out_bytes = collect_bytes e
81+ let out_bytes = collect_bytes e
9182 out_param_count = param_count e
92− in return $ if out_param_count == expected_param_count
83+ in if out_param_count == expected_param_count
9384 then verify_bytes_equal out_bytes expected_bytes
9485 else failed { reason = "out param count /= expected param count" }
9586
9687dec_print_param_caps (DecPrintCap cap_string expected_param_count expected_bytes) = do
9788 verify_parse_cap cap_string $ \e ->
98− let expected_count :: Word8 = toEnum $ length expected_bytes
99− out_bytes = collect_bytes e
89+ let out_bytes = collect_bytes e
10090 out_param_count = param_count e
101− in return $ if out_param_count == expected_param_count
91+ in if out_param_count == expected_param_count
10292 then verify_bytes_equal out_bytes expected_bytes
10393 else failed { reason = "out param count /= expected param count" }
10494
@@ -106,6 +96,6 @@ print_cap ti cap_name = do
10696 putStrLn $ cap_name ++ ": " ++ show (from_capname ti cap_name)
10797
10898print_expression ti cap_name = do
109− parse_result <- parse_cap_expression $ from_capname ti cap_name
99+ let parse_result = parse_cap_expression $ from_capname ti cap_name
110100 putStrLn $ cap_name ++ ": " ++ show parse_result
111101