Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

test coverage bits

  • Loading branch information...
commit c4b270a7279d2d939618642f2d2cf08e715a3a81 1 parent 397db46
Paul Tagliamonte authored
6 hy/lex/states.py
@@ -233,7 +233,11 @@ def process(self, char):
233 233 if char == "n":
234 234 self.nodes.append("\n")
235 235 return
236   - raise LexException("Unknown modifier")
  236 + if char == "\\":
  237 + self.nodes.append("\\")
  238 + return
  239 +
  240 + raise LexException("Unknown modifier: `%s'" % (char))
237 241
238 242 if char == "\"":
239 243 return Idle
6 tests/compilers/test_ast.py
@@ -89,15 +89,15 @@ def test_ast_non_kwapplyable():
89 89
90 90
91 91 def test_ast_print():
92   - """ Ensure print doesn't suck. """
93 92 code = hy_compile(tokenize("(print \"foo\")")).body[0]
  93 +
94 94 if sys.version_info[0] >= 3:
95 95 assert type(code.value) == ast.Call
96 96 return
97 97 assert type(code) == ast.Print
98 98
99 99
100   -def test_ast_print():
101   - """ Ensure print doesn't suck. """
  100 +def test_ast_tuple():
  101 + """ Ensure tuples work. """
102 102 code = hy_compile(tokenize("(, 1 2 3)")).body[0].value
103 103 assert type(code) == ast.Tuple
18 tests/lex/test_lex.py
@@ -148,3 +148,21 @@ def test_nospace():
148 148
149 149 assert entry.end_line == 1
150 150 assert entry.end_column == 13
  151 +
  152 +
  153 +def test_escapes():
  154 + """ Ensure we can escape things """
  155 + entry = tokenize("(foo \"foo\\n\")")[0]
  156 + assert entry[1] == "foo\n"
  157 +
  158 + try:
  159 + entry = tokenize("(foo \"foo\s\")")[0]
  160 + assert True is False
  161 + except LexException:
  162 + pass
  163 +
  164 +
  165 +def test_hashbang():
  166 + """ Ensure we can escape things """
  167 + entry = tokenize("#!this is a comment\n")
  168 + assert entry == []

0 comments on commit c4b270a

Please sign in to comment.
Something went wrong with that request. Please try again.