@@ -33,13 +33,6 @@ module Data.Text.Internal.Encoding.Utf8
33
33
, validate4
34
34
) where
35
35
36
- #if defined(TEST_SUITE)
37
- # undef ASSERTS
38
- #endif
39
-
40
- #if defined(ASSERTS)
41
- import Control.Exception (assert )
42
- #endif
43
36
import Data.Bits ((.&.) )
44
37
import Data.Text.Internal.Unsafe.Char (ord )
45
38
import Data.Text.Internal.Unsafe.Shift (shiftR )
@@ -62,9 +55,9 @@ between x y z = x >= y && x <= z
62
55
63
56
ord2 :: Char -> (Word8 ,Word8 )
64
57
ord2 c =
65
- #if defined(ASSERTS)
66
- assert (n >= 0x80 && n <= 0x07ff )
67
- #endif
58
+ -- ord2 is used only in test suite to construct a deliberately invalid ByteString,
59
+ -- actually violating the assertion, so it is commented out
60
+ -- assert (n >= 0x80 && n <= 0x07ff)
68
61
(x1,x2)
69
62
where
70
63
n = ord c
@@ -73,9 +66,9 @@ ord2 c =
73
66
74
67
ord3 :: Char -> (Word8 ,Word8 ,Word8 )
75
68
ord3 c =
76
- #if defined(ASSERTS)
77
- assert (n >= 0x0800 && n <= 0xffff )
78
- #endif
69
+ -- ord3 is used only in test suite to construct a deliberately invalid ByteString,
70
+ -- actually violating the assertion, so it is commented out
71
+ -- assert (n >= 0x0800 && n <= 0xffff)
79
72
(x1,x2,x3)
80
73
where
81
74
n = ord c
@@ -85,9 +78,9 @@ ord3 c =
85
78
86
79
ord4 :: Char -> (Word8 ,Word8 ,Word8 ,Word8 )
87
80
ord4 c =
88
- #if defined(ASSERTS)
89
- assert (n >= 0x10000 )
90
- #endif
81
+ -- ord4 is used only in test suite to construct a deliberately invalid ByteString,
82
+ -- actually violating the assertion, so it is commented out
83
+ -- assert (n >= 0x10000)
91
84
(x1,x2,x3,x4)
92
85
where
93
86
n = ord c
0 commit comments