Screw.Unitを試してみた

Screw.Unit(function() {
  describe('Pro JavaScript Techniques chapter 3', function() {
		describe('five_add = addGenerator(5)', function() {
			function addGenerator(num) {
				return function(toAdd) {
					return num + toAdd;
				};
			}
			
			before(function() {
				five_add = addGenerator(5);				
			});

	    it("should equal 9 when add 4", function() {
				expect(five_add(4)).to(equal, 9);
	    });
	
	    it("should equal 3 when add -2", function() {
				expect(five_add(-2)).to(equal, 3);
	    });
		});
	});
});
	    it("should equal 3 when add -2", function() {
	      expect(five_add(-2)).to(equal, 3);
	    });

Test.SimpleのシンプルなAPIを見た後だと、かえって読みにくいのかなぁと。

	    it("should equal 3 when add -2", function() {
	      expect(five_add(-2)) == 3);
	    });

	    it("five_add(-2)) == 3", function() {
	      ok(five_add(-2)) == 3);
	    });

と書きたい気がしてきた(書けないよ)