|
291 | 291 | (deftest barf-forward-test
|
292 | 292 | (doseq [opts zipper-opts]
|
293 | 293 | (testing (zipper-opts-desc opts)
|
294 |
| - (doseq [[s expected] |
295 |
| - [["[[⊚1 2 3] 4]" "[[⊚1 2] 3 4]"] |
296 |
| - ["[[1 ⊚2 3] 4]" "[[1 ⊚2] 3 4]"] |
297 |
| - ["[[1 2 ⊚3] 4]" "[[1 2] ⊚3 4]"] |
298 |
| - ["[[1 2 3⊚ ] 4]" "[[1 2] ⊚3 4]"] |
299 |
| - ["[[⊚1] 2]" "[[] ⊚1 2]"] |
300 |
| - ["(⊚(x) 1)" "(⊚(x)) 1"] |
301 |
| - ["(⊚(x)1)" "(⊚(x)) 1"] |
302 |
| - ["(⊚(x)(y))" "(⊚(x)) (y)"] |
303 |
| - ["[⊚{:a 1} {:b 2} {:c 3}]" "[⊚{:a 1} {:b 2}] {:c 3}"] |
304 |
| - ["[{:a 1} ⊚{:b 2} {:c 3}]" "[{:a 1} ⊚{:b 2}] {:c 3}"] |
305 |
| - ["[{:a 1} {:b 2} ⊚{:c 3}]" "[{:a 1} {:b 2}] ⊚{:c 3}"]]] |
306 |
| - (let [zloc (th/of-locmarked-string s opts)] |
307 |
| - (is (= s (th/root-locmarked-string zloc)) "string before") |
308 |
| - (is (= expected (-> zloc pe/barf-forward th/root-locmarked-string)) "string after")))))) |
| 294 | + (doseq [[s expected] |
| 295 | + [["[[1 ⊚2 3] 4]" "[[1 ⊚2] 3 4]"] |
| 296 | + ["[[⊚1 2 3] 4]" "[[⊚1 2] 3 4]" ] |
| 297 | + ["[[1 2 ⊚3] 4]" "[[1 2] ⊚3 4]"] |
| 298 | + ["[[1 2 3⊚ ] 4]" "[[1 2] ⊚3 4]"] |
| 299 | + ["[[1 2⊚ 3] 4]" "[[1 2] ⊚3 4]"] |
| 300 | + ["[[⊚1] 2]" "[[] ⊚1 2]"] |
| 301 | + ["(⊚(x) 1)" "(⊚(x)) 1"] |
| 302 | + ["(⊚(x)1)" "(⊚(x)) 1"] |
| 303 | + ["(⊚(x)(y))" "(⊚(x)) (y)"] |
| 304 | + ["[⊚{:a 1} {:b 2} {:c 3}]" "[⊚{:a 1} {:b 2}] {:c 3}"] |
| 305 | + ["[{:a 1} ⊚{:b 2} {:c 3}]" "[{:a 1} ⊚{:b 2}] {:c 3}"] |
| 306 | + ["[{:a 1} {:b 2} ⊚{:c 3}]" "[{:a 1} {:b 2}] ⊚{:c 3}"] |
| 307 | + ["[⊚1 ;; comment\n2]" "[⊚1];; comment\n2"] |
| 308 | + ["[1 ⊚;; comment\n2]" "[1];; comment\n⊚2"] |
| 309 | + ["[1 ;; comment\n⊚2]" "[1];; comment\n⊚2"] |
| 310 | + ["[1 ;; comment\n⊚2]" "[1];; comment\n⊚2"] |
| 311 | + ["[1 ;; cmt1\n;; cmt2\n⊚2]" "[1];; cmt1\n;; cmt2\n⊚2"] |
| 312 | + ["[1 \n \n;; cmt1\n \n;; cmt2\n \n\n ⊚2]" "[1]\n\n;; cmt1\n\n;; cmt2\n\n\n⊚2"]]] |
| 313 | + (testing s |
| 314 | + (let [zloc (th/of-locmarked-string s opts)] |
| 315 | + (is (= s (th/root-locmarked-string zloc)) "(sanity) string before") |
| 316 | + (is (= expected (-> zloc pe/barf-forward th/root-locmarked-string)) "root string after"))))))) |
309 | 317 |
|
310 | 318 | (deftest barf-backward-test
|
311 | 319 | (doseq [opts zipper-opts]
|
312 | 320 | (testing (zipper-opts-desc opts)
|
313 |
| - (doseq [[s expected] |
314 |
| - [["[1 [2 3 ⊚4]]" "[1 2 [3 ⊚4]]"] |
315 |
| - ["[1 [⊚2 3 4]]" "[1 ⊚2 [3 4]]"]]] |
316 |
| - (let [zloc (th/of-locmarked-string s opts)] |
317 |
| - (is (= s (th/root-locmarked-string zloc)) "(sanity) string before") |
318 |
| - (is (= expected (-> zloc pe/barf-backward th/root-locmarked-string)) "string after")))))) |
| 321 | + (doseq [[s expected] |
| 322 | + [["[1 [2 ⊚3 4]]" "[1 2 [⊚3 4]]"] |
| 323 | + ["[1 [2 3 ⊚4]]" "[1 2 [3 ⊚4]]"] |
| 324 | + ["[1 [⊚2 3 4]]" "[1 ⊚2 [3 4]]"] |
| 325 | + ["[1 [2⊚ 3 4]]" "[1 ⊚2 [3 4]]"] |
| 326 | + ["[1 [⊚ 2 3 4]]" "[1 ⊚2 [3 4]]"] |
| 327 | + ["[1 [⊚2]]" "[1 ⊚2 []]"] |
| 328 | + ["(1 ⊚(x))" "1 (⊚(x))"] |
| 329 | + ["(1⊚(x))" "1 (⊚(x))"] |
| 330 | + ["((x)⊚(y))" "(x) (⊚(y))"] |
| 331 | + ["[{:a 1} {:b 2} ⊚{:c 3}]" "{:a 1} [{:b 2} ⊚{:c 3}]"] |
| 332 | + ["[{:a 1} ⊚{:b 2} {:c 3}]" "{:a 1} [⊚{:b 2} {:c 3}]"] |
| 333 | + ["[⊚{:a 1} {:b 2} {:c 3}]" "⊚{:a 1} [{:b 2} {:c 3}]"] |
| 334 | + ["[1 ;; comment\n⊚2]" "1 ;; comment\n[⊚2]"] |
| 335 | + ["[1 ⊚;; comment\n2]" "⊚1 ;; comment\n[2]"] |
| 336 | + ["[⊚1 ;; comment\n2]" "⊚1 ;; comment\n[2]"] |
| 337 | + ["[⊚1 ;; cmt1\n;; cmt2\n2]" "⊚1 ;; cmt1\n;; cmt2\n[2]"] |
| 338 | + ["[⊚1 \n \n;; cmt1\n \n;; cmt2\n \n\n 2]" "⊚1 \n\n;; cmt1\n\n;; cmt2\n\n\n[2]"]]] |
| 339 | + (testing s |
| 340 | + (let [zloc (th/of-locmarked-string s opts)] |
| 341 | + (is (= s (th/root-locmarked-string zloc)) "(sanity) string before") |
| 342 | + (is (= expected (-> zloc pe/barf-backward th/root-locmarked-string)) "root string after"))))))) |
319 | 343 |
|
320 | 344 | (deftest wrap-around-test
|
321 | 345 | (doseq [opts zipper-opts]
|
|
0 commit comments