1/* 2 * Copyright (c) 2024 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 ' + actualValue + ' equals ' + expect; 29 } 30 if (matcherName === 'assertContain') { 31 return 'expect not have, ' + actualValue + ' have ' + expect; 32 } 33 if (matcherName === 'assertInstanceOf') { 34 return 'expect not InstanceOf, ' + actualValue + ' is ' + 35 Object.prototype.toString.call(actualValue) + expect; 36 } 37 if (matcherName === 'assertLarger') { 38 return 'expect not Larger, ' + 39 (actualValue) + ' is larger than ' + expect; 40 } 41 if (matcherName === 'assertLargerOrEqual') { 42 return 'expect not LargerOrEqual, ' + (actualValue) + ' larger than ' + expect; 43 } 44 if (matcherName === 'assertLess') { 45 return 'expect not Less, ' + (actualValue) + ' less than ' + expect; 46 } 47 if (matcherName === 'assertLessOrEqual') { 48 return 'expect not LessOrEqual, ' + (actualValue) + ' is less than ' + expect; 49 } 50 if (matcherName === 'assertNaN') { 51 return 'expect not NaN, actualValue is ' + (actualValue); 52 } 53 if (matcherName === 'assertNegUnlimited') { 54 return 'expect not NegUnlimited, actualValue is ' + (actualValue); 55 } 56 if (matcherName === 'assertPosUnlimited') { 57 return 'expect not PosUnlimited, actualValue is ' + (actualValue); 58 } 59 if (matcherName === 'assertUndefined') { 60 return 'expect not Undefined, actualValue is ' + (actualValue); 61 } 62 return originMsg; 63 } 64} 65export default LogExpectError;