diff options
Diffstat (limited to 'contexts/data/lib/closure-library/closure/goog/labs/testing/objectmatcher_test.html')
-rw-r--r-- | contexts/data/lib/closure-library/closure/goog/labs/testing/objectmatcher_test.html | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/contexts/data/lib/closure-library/closure/goog/labs/testing/objectmatcher_test.html b/contexts/data/lib/closure-library/closure/goog/labs/testing/objectmatcher_test.html deleted file mode 100644 index 92cc2de..0000000 --- a/contexts/data/lib/closure-library/closure/goog/labs/testing/objectmatcher_test.html +++ /dev/null @@ -1,102 +0,0 @@ -<!DOCTYPE html> -<html> -<!-- -Copyright 2012 The Closure Library Authors. All Rights Reserved. - -Use of this source code is governed by the Apache License, Version 2.0. -See the COPYING file for details. ---> -<head> -<title>Closure Unit Tests - Object matchers</title> -<script src="../../base.js"></script> -<script> - -goog.require('goog.labs.testing.ObjectEqualsMatcher'); -goog.require('goog.labs.testing.HasPropertyMatcher'); -goog.require('goog.labs.testing.InstanceOfMatcher'); -goog.require('goog.labs.testing.IsNullOrUndefinedMatcher'); -goog.require('goog.labs.testing.IsNullMatcher'); -goog.require('goog.labs.testing.IsUndefinedMatcher'); -goog.require('goog.labs.testing.assertThat'); -goog.require('goog.testing.jsunit'); - -</script> -</head> -<body> -<script> - -function testObjectEquals() { - var obj1 = {x: 1}; - var obj2 = obj1; - goog.labs.testing.assertThat(obj1, equalsObject(obj2), 'obj1 equals obj2'); - - assertMatcherError(function() { - goog.labs.testing.assertThat({x: 1}, equalsObject({})); - }, 'equalsObject does not throw exception on failure'); -} - -function testInstanceOf() { - function expected() { - this.x = 1; - } - var input = new expected(); - goog.labs.testing.assertThat(input, instanceOfClass(expected), - 'input is an instance of expected'); - - assertMatcherError(function() { - goog.labs.testing.assertThat(5, instanceOfClass(function() {})); - }, 'instanceOfClass does not throw exception on failure'); -} - -function testHasProperty() { - goog.labs.testing.assertThat({x: 1}, hasProperty('x'), - '{x:1} has property x}'); - - assertMatcherError(function() { - goog.labs.testing.assertThat({x: 1}, hasProperty('y')); - }, 'hasProperty does not throw exception on failure'); -} - -function testIsNull() { - goog.labs.testing.assertThat(null, isNull(), 'null is null'); - - assertMatcherError(function() { - goog.labs.testing.assertThat(5, isNull()); - }, 'isNull does not throw exception on failure'); -} - -function testIsNullOrUndefined() { - var x; - goog.labs.testing.assertThat(undefined, isNullOrUndefined(), - 'undefined is null or undefined'); - goog.labs.testing.assertThat(x, isNullOrUndefined(), - 'undefined is null or undefined'); - x = null; - goog.labs.testing.assertThat(null, isNullOrUndefined(), - 'null is null or undefined'); - goog.labs.testing.assertThat(x, isNullOrUndefined(), - 'null is null or undefined'); - - assertMatcherError(function() { - goog.labs.testing.assertThat(5, isNullOrUndefined()); - }, 'isNullOrUndefined does not throw exception on failure'); -} - -function testIsUndefined() { - var x; - goog.labs.testing.assertThat(undefined, isUndefined(), - 'undefined is undefined'); - goog.labs.testing.assertThat(x, isUndefined(), 'undefined is undefined'); - - assertMatcherError(function() { - goog.labs.testing.assertThat(5, isUndefined()); - }, 'isUndefined does not throw exception on failure'); -} - -function assertMatcherError(callable, errorString) { - var e = assertThrows(errorString || 'callable throws exception', callable); - assertTrue(e instanceof goog.labs.testing.MatcherError); -} -</script> -</body> -</html> |