|
50 | 50 | (haskell-cabal-previous-subsection)
|
51 | 51 | (haskell-cabal-previous-section))))
|
52 | 52 |
|
| 53 | +(ert-deftest haskell-cabal-subsection-arrange-lines-keep-commas () |
| 54 | + (should (with-temp-buffer |
| 55 | + (insert "Executable bin-1 |
| 56 | + Main-Is: TestParsing.hs |
| 57 | + Build-Depends: base, |
| 58 | + bytestring, |
| 59 | + directory, |
| 60 | + filepath, |
| 61 | + text |
| 62 | + Ghc-Options: -O -Wall |
| 63 | +") |
| 64 | + (haskell-cabal-mode) |
| 65 | + (goto-char (point-min)) |
| 66 | + (search-forward "Build-Depends:") |
| 67 | + (haskell-cabal-subsection-arrange-lines) |
| 68 | + (string= (buffer-string) |
| 69 | + "Executable bin-1 |
| 70 | + Main-Is: TestParsing.hs |
| 71 | + Build-Depends: base |
| 72 | + , bytestring |
| 73 | + , directory |
| 74 | + , filepath |
| 75 | + , text |
| 76 | + Ghc-Options: -O -Wall |
| 77 | +")))) |
| 78 | + |
| 79 | +(ert-deftest haskell-cabal-subsection-arrange-lines-no-commas () |
| 80 | + (should (with-temp-buffer |
| 81 | + (insert "Executable bin-1 |
| 82 | + Main-Is: TestParsing.hs |
| 83 | + Other-Modules: Some.Module |
| 84 | + Some.Other.Other.Module |
| 85 | + Some.Other.Module |
| 86 | +") |
| 87 | + (haskell-cabal-mode) |
| 88 | + (goto-char (point-min)) |
| 89 | + (search-forward "Other-Modules:") |
| 90 | + (haskell-cabal-subsection-arrange-lines) |
| 91 | + (string= (buffer-string) |
| 92 | + "Executable bin-1 |
| 93 | + Main-Is: TestParsing.hs |
| 94 | + Other-Modules: Some.Module |
| 95 | + Some.Other.Module |
| 96 | + Some.Other.Other.Module |
| 97 | +")))) |
| 98 | + |
| 99 | + |
| 100 | +(ert-deftest haskell-cabal-subsection-arrange-lines-quoted-items () |
| 101 | + (should (with-temp-buffer |
| 102 | + (insert "Executable bin-1 |
| 103 | + Main-Is: TestParsing.hs |
| 104 | + GHC-Options: -fprof-auto \"-with-rtsopts=-N -p -s -h -i0.1\" |
| 105 | +") |
| 106 | + (haskell-cabal-mode) |
| 107 | + (goto-char (point-min)) |
| 108 | + (search-forward "GHC-Options:") |
| 109 | + (haskell-cabal-subsection-arrange-lines) |
| 110 | + (string= (buffer-string) |
| 111 | + "Executable bin-1 |
| 112 | + Main-Is: TestParsing.hs |
| 113 | + GHC-Options: -fprof-auto \"-with-rtsopts=-N -p -s -h -i0.1\" |
| 114 | +")))) |
| 115 | + |
| 116 | +(ert-deftest haskell-cabal-subsection-arrange-lines-no-commas-quoted-comma () |
| 117 | + (should (with-temp-buffer |
| 118 | + (insert "Executable bin-1 |
| 119 | + Main-Is: TestParsing.hs |
| 120 | + GHC-Options: -Wall -fprof-auto \"foo, bar\" |
| 121 | +") |
| 122 | + (haskell-cabal-mode) |
| 123 | + (goto-char (point-min)) |
| 124 | + (search-forward "GHC-Options:") |
| 125 | + (haskell-cabal-subsection-arrange-lines) |
| 126 | + (string= (buffer-string) |
| 127 | + "Executable bin-1 |
| 128 | + Main-Is: TestParsing.hs |
| 129 | + GHC-Options: -Wall -fprof-auto \"foo, bar\" |
| 130 | +")))) |
| 131 | + |
| 132 | +(ert-deftest haskell-cabal-subsection-arrange-lines-commas-quoted-comma () |
| 133 | + (should (with-temp-buffer |
| 134 | + (insert "Executable bin-1 |
| 135 | + Main-Is: TestParsing.hs |
| 136 | + GHC-Options: -Wall, -fprof-auto \"foo, bar\" |
| 137 | +") |
| 138 | + (haskell-cabal-mode) |
| 139 | + (goto-char (point-min)) |
| 140 | + (search-forward "GHC-Options:") |
| 141 | + (haskell-cabal-subsection-arrange-lines) |
| 142 | + (string= (buffer-string) |
| 143 | + "Executable bin-1 |
| 144 | + Main-Is: TestParsing.hs |
| 145 | + GHC-Options: -Wall |
| 146 | + , -fprof-auto \"foo, bar\" |
| 147 | +")))) |
| 148 | + |
| 149 | +(ert-deftest haskell-cabal-subsection-arrange-lines-comma-in-commment () |
| 150 | + (should (with-temp-buffer |
| 151 | + (insert "Executable bin-1 |
| 152 | + Main-Is: TestParsing.hs |
| 153 | + Other-Modules: Some.Module |
| 154 | + Some.Other.Other.Module |
| 155 | + Some.Other.Module |
| 156 | + -- Foo, bar |
| 157 | +") |
| 158 | + (haskell-cabal-mode) |
| 159 | + (goto-char (point-min)) |
| 160 | + (search-forward "Other-Modules:") |
| 161 | + (haskell-cabal-subsection-arrange-lines) |
| 162 | + (string= (buffer-string) |
| 163 | + "Executable bin-1 |
| 164 | + Main-Is: TestParsing.hs |
| 165 | + Other-Modules: Some.Module |
| 166 | + Some.Other.Module |
| 167 | + Some.Other.Other.Module |
| 168 | + -- Foo, bar |
| 169 | +")))) |
| 170 | + |
53 | 171 | (provide 'haskell-cabal-tests)
|
54 | 172 |
|
55 | 173 | ;;; haskell-cabal-tests.el ends here
|
0 commit comments