blob: 85323dc6b246cf623eec8456ab2b5cc18a60639e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<!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 - Decorator matchers</title>
<script src="../../base.js"></script>
<script>
goog.require('goog.labs.testing.AnythingMatcher');
goog.require('goog.labs.testing.GreaterThanMatcher');
goog.require('goog.labs.testing.assertThat');
goog.require('goog.testing.jsunit');
</script>
</head>
<body>
<script>
function testAnythingMatcher() {
goog.labs.testing.assertThat(true, anything(), 'anything matches true');
goog.labs.testing.assertThat(false, anything(), 'false matches anything');
}
function testIs() {
goog.labs.testing.assertThat(5, is(greaterThan(4)), '5 is > 4');
}
function testDescribedAs() {
var e = assertThrows(function() {
goog.labs.testing.assertThat(4, describedAs('this is a test',
greaterThan(6)))});
assertTrue(e instanceof goog.labs.testing.MatcherError);
assertEquals('this is a test', e.message);
}
</script>
</body>
</html>
|