• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
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
16class LogExpectError {
17    static getErrorMsg(matcherName, actualValue, expect, originMsg) {
18        if (matcherName === "assertNull") {
19            return "expect not null, actualValue is " + (actualValue)
20        }
21        if (matcherName === "assertTrue") {
22            return "expect not true, actualValue is " + (actualValue)
23        }
24        if (matcherName === "assertFalse") {
25            return "expect not false, actualValue is " + (actualValue)
26        }
27        if (matcherName === "assertEqual") {
28            return "expect not Equal, actualValue is "
29                + actualValue + ' equals ' + expect;
30        }
31        if (matcherName === "assertContain") {
32            return "expect not have, " + actualValue + " have " + expect;
33        }
34        if (matcherName === "assertInstanceOf") {
35            return "expect not InstanceOf, "
36                + actualValue + ' is '
37                + Object.prototype.toString.call(actualValue) +  expected;
38        }
39        if (matcherName === "assertLarger") {
40            return "expect not Larger, "
41                + (actualValue) + ' is larger than ' + expected;
42        }
43        if (matcherName === "assertLargerOrEqual") {
44            return "expect not LargerOrEqual, "
45                + (actualValue) + ' larger than ' + expected;
46        }
47        if (matcherName === "assertLess") {
48            return "expect not Less, "
49                + (actualValue) + ' less than ' + expected;
50        }
51        if (matcherName === "assertLessOrEqual") {
52            return "expect not LessOrEqual, "
53                + (actualValue) + ' is less than ' + expected;
54        }
55        if (matcherName === "assertNaN") {
56            return "expect not NaN, actualValue is " + (actualValue)
57        }
58        if (matcherName === "assertNegUnlimited") {
59            return "expect not NegUnlimited, actualValue is " + (actualValue)
60        }
61        if (matcherName === "assertPosUnlimited") {
62            return "expect not PosUnlimited, actualValue is " + (actualValue)
63        }
64        if (matcherName === "assertUndefined") {
65            return "expect not Undefined, actualValue is " + (actualValue)
66        }
67        return originMsg;
68    }
69}
70export default  LogExpectError