21
21
(require 'purescript-sort-imports )
22
22
23
23
(ert-deftest empty-buffer ()
24
- (should ( with-temp-buffer
24
+ (with-temp-buffer
25
25
(purescript-sort-imports)
26
- t )))
26
+ t ))
27
27
28
28
(ert-deftest single-line ()
29
- (should ( with-temp-buffer
29
+ (with-temp-buffer
30
30
(insert " import A\n " )
31
31
(goto-char (point-min ))
32
32
(purescript-sort-imports)
33
- (string= (buffer-string )
34
- " import A\n " ))))
33
+ (should ( string= (buffer-string )
34
+ " import A\n " ))))
35
35
36
36
(ert-deftest two-idem ()
37
- (should ( with-temp-buffer
37
+ (with-temp-buffer
38
38
(insert " import A
39
39
import B
40
40
" )
41
41
(goto-char (point-min ))
42
42
(purescript-sort-imports)
43
- (string= (buffer-string )
44
- " import A
43
+ (should ( string= (buffer-string )
44
+ " import A
45
45
import B
46
46
" )))
47
- (should ( with-temp-buffer
47
+ (with-temp-buffer
48
48
(insert " import A (A, B, C)
49
49
import B
50
50
" )
51
51
(goto-char (point-min ))
52
52
(purescript-sort-imports)
53
- (string= (buffer-string )
54
- " import A (A, B, C)
53
+ (should ( string= (buffer-string )
54
+ " import A (A, B, C)
55
55
import B
56
56
" )))
57
- (should ( with-temp-buffer
57
+ (with-temp-buffer
58
58
(insert " import A (mtl)
59
59
import B
60
60
" )
61
61
(goto-char (point-min ))
62
62
(purescript-sort-imports)
63
- (string= (buffer-string )
64
- " import A (mtl)
63
+ (should ( string= (buffer-string )
64
+ " import A (mtl)
65
65
import B
66
66
" ))))
67
67
68
68
(ert-deftest two-rev ()
69
- (should ( with-temp-buffer
69
+ (with-temp-buffer
70
70
(insert " import B
71
71
import A
72
72
" )
73
73
(goto-char (point-min ))
74
74
(purescript-sort-imports)
75
- (string= (buffer-string )
76
- " import A
75
+ (should ( string= (buffer-string )
76
+ " import A
77
77
import B
78
78
" ))))
79
79
80
80
(ert-deftest file-structure ()
81
- (should ( with-temp-buffer
81
+ (with-temp-buffer
82
82
(insert " module A where
83
83
import B
84
84
import A
@@ -87,12 +87,12 @@ import A
87
87
(goto-char (point-min ))
88
88
(forward-line 1 )
89
89
(purescript-sort-imports)
90
- (string= (buffer-string )
91
- " module A where
90
+ (should ( string= (buffer-string )
91
+ " module A where
92
92
import A
93
93
import B
94
94
" )))
95
- (should ( with-temp-buffer
95
+ (with-temp-buffer
96
96
(insert " module C where
97
97
98
98
import B
@@ -102,15 +102,15 @@ import A
102
102
(goto-char (point-min ))
103
103
(forward-line 2 )
104
104
(purescript-sort-imports)
105
- (string= (buffer-string )
106
- " module C where
105
+ (should ( string= (buffer-string )
106
+ " module C where
107
107
108
108
import A
109
109
import B
110
110
" ))))
111
111
112
112
(ert-deftest bos-270 ()
113
- (should ( with-temp-buffer
113
+ (with-temp-buffer
114
114
(insert " import Data.Aeson.Encode (encode)
115
115
import Data.Aeson.Types
116
116
import Data.Aeson.Parser.Internal (decodeWith, decodeStrictWith,
@@ -121,8 +121,8 @@ import Data.ByteString.Lazy as L
121
121
" )
122
122
(goto-char (point-min ))
123
123
(purescript-sort-imports)
124
- (string= (buffer-string )
125
- " import Data.Aeson.Encode (encode)
124
+ (should ( string= (buffer-string )
125
+ " import Data.Aeson.Encode (encode)
126
126
import Data.Aeson.Parser.Internal (decodeWith, decodeStrictWith,
127
127
eitherDecodeWith, eitherDecodeStrictWith,
128
128
jsonEOF, json, jsonEOF', json')
0 commit comments