Debian Codegraph @

closure-library/closure/goog/labs/testing/decoratormatcher_test.js

raw
1 // Copyright 2012 The Closure Library Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS-IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 goog.provide('goog.labs.testing.decoratorMatcherTest');
16 goog.setTestOnly('goog.labs.testing.decoratorMatcherTest');
17
18 /** @suppress {extraRequire} */
19 goog.require('goog.labs.testing.AnythingMatcher');
20 /** @suppress {extraRequire} */
21 goog.require('goog.labs.testing.GreaterThanMatcher');
22 goog.require('goog.labs.testing.MatcherError');
23 goog.require('goog.labs.testing.assertThat');
24 goog.require('goog.testing.jsunit');
25
26 function testAnythingMatcher() {
27 goog.labs.testing.assertThat(true, anything(), 'anything matches true');
28 goog.labs.testing.assertThat(false, anything(), 'false matches anything');
29 }
30
31 function testIs() {
32 goog.labs.testing.assertThat(5, is(greaterThan(4)), '5 is > 4');
33 }
34
35 function testDescribedAs() {
36 var e = assertThrows(function() {
37 goog.labs.testing.assertThat(
38 4, describedAs('this is a test', greaterThan(6)))
39 });
40 assertTrue(e instanceof goog.labs.testing.MatcherError);
41 assertEquals('this is a test', e.message);
42 }