| 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 | /** |
| 16 | * @fileoverview Provides the base Matcher interface. User code should use the |
| 17 | * matchers through assertThat statements and not directly. |
| 18 | */ |
| 19 | |
| 20 | |
| 21 | goog.provide('goog.labs.testing.Matcher'); |
| 22 | |
| 23 | |
| 24 | |
| 25 | /** |
| 26 | * A matcher object to be used in assertThat statements. |
| 27 | * @interface |
| 28 | */ |
| 29 | goog.labs.testing.Matcher = function() {}; |
| 30 | |
| 31 | |
| 32 | /** |
| 33 | * Determines whether a value matches the constraints of the match. |
| 34 | * |
| 35 | * @param {*} value The object to match. |
| 36 | * @return {boolean} Whether the input value matches this matcher. |
| 37 | */ |
| 38 | goog.labs.testing.Matcher.prototype.matches = function(value) {}; |
| 39 | |
| 40 | |
| 41 | /** |
| 42 | * Describes why the matcher failed. |
| 43 | * |
| 44 | * @param {*} value The value that didn't match. |
| 45 | * @param {string=} opt_description A partial description to which the reason |
| 46 | * will be appended. |
| 47 | * |
| 48 | * @return {string} Description of why the matcher failed. |
| 49 | */ |
| 50 | goog.labs.testing.Matcher.prototype.describe = |
| 51 | function(value, opt_description) {}; |