开发者

qunit with jsmock test failing and I don't know why :)

There is a test http://jsfiddle.net/misza222/g7Cur/ and it is开发者_运维问答 failing. Does anyone know why?


You need to make the Point parameters to both calls of clear() be the same:

        test("Testing the test", function() {
          var mc = new MockControl();
          var canvas = mc.createMock(Canvas.prototype);
          var p1 = new Point(0,0), p2 = new Point(1,1); 
          canvas.expects().clear(p1, p2);
          canvas.clear(p1, p2);
          mc.verify();
        });

Even though your lines:

          canvas.expects().clear(new Point(0,0), new Point(1,1));
          canvas.clear(new Point(0,0), new Point(1,1));

look the same, you are actually passing different Point objects into the two calls.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜