Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
QUnit.m brings QUnit.js syntax to SenTestingKit for testing Objective-C projects.
Objective-C Ruby
branch: master
Failed to load latest commit information.
Classes Updated to newest CocoaPods spec
Config Updated project to match _. and SubjectiveScript.m configuration
QUnit.m.xcodeproj Fixing pod lib lint
Tests Bumped version 0.1.1
.gitignore Initial commit (fresh project)
CHANGELOG.md Updated to newest CocoaPods spec
LICENSE Updated to newest CocoaPods spec
QUnit.m.podspec Release 0.1.2
README.md
Rakefile Revert Rakefile problems

README.md

QUnit.m

Version Platform

QUnit.m brings QUnit.js syntax to SenTestingKit for testing Objective-C projects. The is useful if you are trying to port JavaScript libraries to Objective-C or want a more familiar testing syntax.

I wrote this to help me port Underscore.js to Objective-C in _.m and to make Objective-C a little more script in Subjective-Script so you will find some good examples in those project's tests.

Note: the library is still in its early days so please submit pull requests with corresponding tests to fix any issues and to bring the feature set up to the level of QUnit.js!

Examples (some from _.m and Subjective-Script)

equal

equal(AI(1,2,3).reverse().join(@","), @"3,2,1", @"reverse works");

strictEqual

strictEqual(_.chain(array).find(^B(N* n) { return n.I > 2; }).N, N.I(3), @"should return first found `value`");

deepEqual

_WrappedBlock wrapped = _.wrap(noop, ^A*(_WrappedBlock fn, id arg1, ...){ ARGS_AO(arguments, arg1); return A.newNSO(fn).concat(arguments); });
A* ret     = wrapped(AO(@"whats", @"your"), @"vector", @"victor", nil);
deepEqual(ret, AO(noop, AO(@"whats", @"your"), @"vector", @"victor"), @"deep wrapping");

notEqual

notEqual(AI(1,2,3).reverse().join(@","), @"1,2,3", @"reverse works");

ok

ok(OKV({@"int", N.I(1)}, {@"float", N.F(2.0)}).hasOwnProperty(@"int"), @"has an int");

raises

raises(^{ _.reduce(A.new, ^(N* memo, N* num, ...){ return memo; }, 0); }, @"TypeError", @"throws an error for empty arrays with no initial value");

asyncTest

asyncTest(^{
  __block BOOL called1 = false;
  SSTimeout* timeout1 = SS.setTimeout(^{ called1 = true; }, NSEC_PER_SEC*1);
  SS.clearTimeout(timeout1);

  __block BOOL called2 = false;
  SS.setTimeout(^{ called2 = true; start(); }, NSEC_PER_SEC*2);
});

Usage

To run the example project; clone the repo, and run pod install from the Project directory first.

Requirements

Installation

QUnit.m is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "QUnit.m"

Author

Kevin Malakoff, kmalakoff@gmail.com

License

QUnit.m is available under the MIT license. See the LICENSE file for more info.

Something went wrong with that request. Please try again.