Skip to content

Commit

Permalink
Fix test tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Tim 'mithro' Ansell <me@mith.ro>
  • Loading branch information
mithro committed Jan 11, 2019
1 parent 8f8458d commit c9efd9f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/test_simple.py 100644 → 100755
@@ -1,21 +1,29 @@
#!/usr/bin/env python3
import os
import os.path

import unittest
import fasm


def example(fname):
return os.path.join(os.path.dirname(__file__), '..', 'examples', fname)


def check_round_trip(test, result):
s = fasm.fasm_tuple_to_string(result)
test.assertEqual(list(fasm.parse_fasm_string(s)), result)


class TestFasm(unittest.TestCase):
def test_blank_file(self):
result = list(fasm.parse_fasm_filename('fasm_blank.fasm'))
result = list(fasm.parse_fasm_filename(example('blank.fasm')))
self.assertEqual(result, [])

check_round_trip(self, result)

def test_comment_file(self):
result = list(fasm.parse_fasm_filename('fasm_comment.fasm'))
result = list(fasm.parse_fasm_filename(example('comment.fasm')))
self.assertEqual(
result, [
fasm.FasmLine(
Expand All @@ -28,7 +36,7 @@ def test_comment_file(self):
check_round_trip(self, result)

def test_one_line_feature(self):
result = list(fasm.parse_fasm_filename('fasm_feature_only.fasm'))
result = list(fasm.parse_fasm_filename(example('feature_only.fasm')))
self.assertEqual(
result, [
fasm.FasmLine(
Expand All @@ -49,7 +57,7 @@ def test_one_line_feature(self):
check_round_trip(self, result)

def test_examples_file(self):
result = list(fasm.parse_fasm_filename('fasm_examples.fasm'))
result = list(fasm.parse_fasm_filename(example('many.fasm')))
check_round_trip(self, result)


Expand Down

0 comments on commit c9efd9f

Please sign in to comment.