def test_outermost_adjacent_parens(self): form = "((resolving-require 'clojure.test/run-tests))" self.set_view_content(form) self.assertEquals( sexp.outermost(self.view, 0).extent(), Region(0, len(form))) self.assertEquals( sexp.outermost(self.view, 1).extent(), Region(0, len(form))) self.assertEquals( sexp.outermost(self.view, 44).extent(), Region(0, len(form))) self.assertEquals( sexp.outermost(self.view, 45).extent(), Region(0, len(form)))
def test_outermost_ignore_comment_set(self): form = "(comment #{1 2 3})" self.set_view_content(form) self.assertEquals( sexp.outermost(self.view, 0, ignore={"comment"}).extent(), Region(0, len(form)), ) self.assertEquals( sexp.outermost(self.view, 1, ignore={"comment"}).extent(), Region(0, len(form)), ) for n in range(9, 17): self.assertEquals( sexp.outermost(self.view, n, ignore={"comment"}).extent(), Region(9, 17))
def test_outermost_macro_character_interference(self): form = "(def ^:foo bar 1)" self.set_view_content(form) for n in range(len(form)): self.assertEquals( sexp.outermost(self.view, n).extent(), Region(0, 17))
def test_outermost(self): form = "(a (b))" self.set_view_content(form) for n in range(len(form)): self.assertEquals( sexp.outermost(self.view, n).extent(), Region(0, 7))
def test_outermost_deref_sexp(self): form = "@(atom 1)" self.set_view_content(form) for n in range(len(form)): self.assertEquals( sexp.outermost(self.view, n).extent(), Region(0, len(form)))
def test_outermost_mixed(self): form = "(a {:b :c} [:d] )" self.set_view_content(form) for n in range(len(form)): self.assertEquals( sexp.outermost(self.view, n).extent(), Region(0, len(form)))
def test_outermost_ignore_string_2(self): form = '(a ""()"" b)' self.set_view_content(form) self.assertEquals( sexp.outermost(self.view, len(form)).extent(), Region(0, len(form)))
def test_outermost_string_next_to_lbracket(self): form = '(merge {"A" :B})' self.set_view_content(form) self.assertEquals( sexp.outermost(self.view, len(form)).extent(), Region(0, len(form)))
def test_outermost_discard(self): form = "(inc #_(dec 2) 4)" self.set_view_content(form) for n in range(len(form)): self.assertEquals( sexp.outermost(self.view, n).extent(), Region(0, len(form)))
def test_outermost_lambda(self): form = "#(+ 1 2 3)" self.set_view_content(form) for n in range(len(form)): self.assertEquals( sexp.outermost(self.view, n).extent(), Region(0, len(form)))