Skip to content

Commit

Permalink
Unit tests for pyscheme
Browse files Browse the repository at this point in the history
Summary:
We finally have unit testing set up!

unittest works just like JUnit - subclass unittest.TestCase for your unit tests
and place them in a file in tests/. Methods prefixed with "test" are executed.

See python's unittest documentation at http://docs.python.org/library/unittest.html

Run all the unit tests with
``python -m unittest discover``

Sadly this functionality is only provided in Python 2.7+
I'll try to get a pre-2.7 solution at some point, given the popularity of 2.6
and its presence on the Berkeley servers.

Issue: #3

Test Plan:
Seriously. You want me to test a unit testing framework.
Fine.
``python -m unittest discover``
  • Loading branch information
Seshadri Mahalingam committed Jul 24, 2011
1 parent 9814cd1 commit 44b5759
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

16 changes: 16 additions & 0 deletions tests/testprim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import unittest

import prim

class PrimitiveSuccessTestCase(unittest.TestCase):

def testPlus(self):
self.assertEquals(prim.plus(1, 2, 3), 6)

class PrimitiveFailureTestCase(unittest.TestCase):

def testPlus(self):
self.assertRaises(TypeError, prim.plus, 1, "two", 3)

# import sys
# unittest.main(sys.modules[__name__])

0 comments on commit 44b5759

Please sign in to comment.