Skip to content

Commit c84c18b

Browse files
committed
Extract test fixes so they shouuuuld run locally and in CI now
1 parent 400df15 commit c84c18b

File tree

2 files changed

+98
-85
lines changed

2 files changed

+98
-85
lines changed

fnl/conjure-spec/extract_spec.fnl

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
(local extract (require :conjure.extract))
44
(local {: with-buf} (require :conjure-spec.util))
55

6+
(fn ex [...]
7+
(let [result (extract.form ...)]
8+
(when result
9+
(set result.node nil))
10+
result))
11+
612
(describe :extract
713
(fn []
814
(describe :current-form
@@ -15,46 +21,46 @@
1521
(assert.same {:range {:start [3 9]
1622
:end [3 16]}
1723
:content "(* 10 2)"}
18-
(extract.form {}))))
24+
(ex {}))))
1925
(it "on the opening paren"
2026
(fn []
2127
(at [3 9])
2228
(assert.same {:range {:start [3 9]
2329
:end [3 16]}
2430
:content "(* 10 2)"}
25-
(extract.form {}))))
31+
(ex {}))))
2632
(it "on the closing paren"
2733
(fn []
2834
(at [3 16])
2935
(assert.same {:range {:start [3 9]
3036
:end [3 16]}
3137
:content "(* 10 2)"}
32-
(extract.form {}))))
38+
(ex {}))))
3339
(it "one before the inner form"
3440
(fn []
3541
(at [3 8])
3642
(assert.same {:range {:start [3 0]
3743
:end [3 17]}
3844
:content "(+ 10 20 (* 10 2))"}
39-
(extract.form {}))))
45+
(ex {}))))
4046
(it "on the last paren of the outer form"
4147
(fn []
4248
(at [3 17])
4349
(assert.same {:range {:start [3 0]
4450
:end [3 17]}
4551
:content "(+ 10 20 (* 10 2))"}
46-
(extract.form {}))))
52+
(ex {}))))
4753
(it "matching nothing"
4854
(fn []
4955
(at [2 0])
50-
(assert.are.equals nil (extract.form {}))))
56+
(assert.are.equals nil (ex {}))))
5157
(it "ns form"
5258
(fn []
5359
(at [1 0])
5460
(assert.same {:range {:start [1 0]
5561
:end [1 7]}
5662
:content "(ns foo)"}
57-
(extract.form {}))))))))
63+
(ex {}))))))))
5864
(describe :root-form
5965
(fn []
6066
(with-buf ["(ns foo)" "" "(+ 10 20 (* 10 2))"]
@@ -65,33 +71,32 @@
6571
(assert.same {:range {:start [3 0]
6672
:end [3 17]}
6773
:content "(+ 10 20 (* 10 2))"}
68-
(extract.form {:root? true}))))
74+
(ex {:root? true}))))
6975
(it "root from the root"
7076
(fn []
7177
(at [3 6])
7278
(assert.same {:range {:start [3 0]
7379
:end [3 17]}
7480
:content "(+ 10 20 (* 10 2))"}
75-
(extract.form {:root? true}))))
81+
(ex {:root? true}))))
7682
(it "root from the opening paren of the root"
7783
(fn []
7884
(at [3 0])
7985
(assert.same {:range {:start [3 0]
8086
:end [3 17]}
8187
:content "(+ 10 20 (* 10 2))"}
82-
(extract.form {:root? true}))))
88+
(ex {:root? true}))))
8389
(it "root from the opening paren of the child form"
8490
(fn []
8591
(at [3 9])
8692
(assert.same {:range {:start [3 0]
8793
:end [3 17]}
8894
:content "(+ 10 20 (* 10 2))"}
89-
(extract.form {:root? true}))))
95+
(ex {:root? true}))))
9096
(it "matching nothing for root"
9197
(fn []
9298
(at [2 0])
93-
(assert.equals nil
94-
(extract.form {:root? true}))))))))
99+
(assert.equals nil (ex {:root? true}))))))))
95100
(describe :ignoring-comments
96101
(fn []
97102
(with-buf ["(ns ohno)" "" "(inc" " ; ()" " 5)"]
@@ -102,14 +107,14 @@
102107
(assert.same {:range {:start [3 0]
103108
:end [5 2]}
104109
:content "(inc\n ; ()\n 5)"}
105-
(extract.form {}))))
110+
(ex {}))))
106111
(it "skips the comment paren with root form"
107112
(fn []
108113
(at [4 0])
109114
(assert.same {:range {:start [3 0]
110115
:end [5 2]}
111116
:content "(inc\n ; ()\n 5)"}
112-
(extract.form {:root? true}))))))))
117+
(ex {:root? true}))))))))
113118
(describe :escaped-parens
114119
(fn []
115120
(with-buf ["(str \\))"]
@@ -120,7 +125,7 @@
120125
(assert.same {:range {:start [1 0]
121126
:end [1 7]}
122127
:content "(str \\))"}
123-
(extract.form {}))))))
128+
(ex {}))))))
124129
(with-buf
125130
["(ns foo)"
126131
""
@@ -138,4 +143,4 @@
138143
(assert.same {:range {:start [5 0]
139144
:end [5 6]}
140145
:content "(+ 1 2)"}
141-
(extract.form {:root? true}))))))))))
146+
(ex {:root? true}))))))))))

lua/conjure-spec/extract_spec.lua

Lines changed: 76 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)