Skip to content

Commit

Permalink
Added a test based off of issue markdrago#14.
Browse files Browse the repository at this point in the history
  • Loading branch information
koyae committed May 30, 2016
1 parent 92d4bfe commit e7cf7e3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/test_pgsanity.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ def test_check_invalid_string(self):
self.assertFalse(success)
self.assertEqual('line 1: ERROR: unrecognized data type name "garbage"', msg)

def test_check_invalid_string_2(self):
text = "SELECT '\n"
text += "-- this is not really a comment' AS c;\n"
text += "SELECT '\n"
text += "-- neither is this' AS c spam;"

(success,msg) = pgsanity.check_string(text)
self.assertFalse(success)
self.assertEqual('line 4: ERROR: syntax error at or near "spam"')

def test_bom_gets_stripped(self):
bomless = "SELECT 'pining for the fjords';".encode('utf-8')
bomful = BOM_UTF8 + bomless
Expand Down

0 comments on commit e7cf7e3

Please sign in to comment.