Nu Class Reference

NuTestCase

Base class for Nu test cases.

Superclass: NSObject
Declared in: nu/test.nu

NuTestCase is an abstract base class for Nu test cases. To create new tests, create a class derived from this class and give your test methods names beginning with "test". As with Ruby's Test::Unit, you can also define methods named "setup" and "teardown" to be run before and after each test method.

Here's an example test:

(class MyTestClass is NuTestCase
  (imethod (id) testPlus is
    (assert_equal 4 (+ 2 2))))


To run your tests, use the "nutest" standalone program. The following invocation runs all of the Nu unit tests from a console (Terminal.app):

% nutest test/test_*.nu

Methods

+ (id) inheritedByClass: (id) testClass
By overriding this method, we detect each time a class is defined in Nu that inherits from this class.

in nu/test.nu

+ (id) runAllTests
Loop over all subclasses of NuTestCase and run all test cases defined in each class.

in nu/test.nu

- (id) run
Run all the test cases for a particular instance of NuTestCase.

in nu/test.nu

- (id) setup
The setup method is called before each test case is executed. The default implementation does nothing.

in nu/test.nu

- (id) teardown
The teardown method is called after each test case is executed. The default implementation does nothing.

in nu/test.nu