提交 eef491bf 编写于 作者: 杜庆泉's avatar 杜庆泉

增加console.log 测试示例

上级 950ee41d
import { describe, test, expect, expectNumber, Result } from './tests.uts'
function obtainInnerObject(obj:Any | null):UTSJSONObject{
let jsonStr = console.getLogV2(obj).slice(19,-17)
let a = JSON.parseArray(jsonStr)![0]
return a as UTSJSONObject
}
export function testConsole() : Result {
return describe("log", () => {
test('log-native-obj', () => {
// #ifdef APP-ANDROID
expect(obtainInnerObject(0.9).get("type")).toEqual("Double");
expect(obtainInnerObject(0.9).get("subType")).toEqual("number");
expect(obtainInnerObject(0.9).get("value")).toEqual("0.9");
// #endif
}
)
})
}
\ No newline at end of file
...@@ -4,7 +4,8 @@ import { testString } from './String.uts' ...@@ -4,7 +4,8 @@ import { testString } from './String.uts'
import { testError } from './Error.uts' import { testError } from './Error.uts'
import { testKeyWord } from './KeyWord.uts' import { testKeyWord } from './KeyWord.uts'
import { testJSON } from './JSON.uts' import { testJSON } from './JSON.uts'
import { testJSONLarge } from './JSON_large.uts' import { testJSONLarge } from './JSON_large.uts'
import { testConsole } from './console.uts'
import { testNumber } from './Number.uts' import { testNumber } from './Number.uts'
import { testMap } from './Map.uts' import { testMap } from './Map.uts'
import { testSet } from './Set.uts' import { testSet } from './Set.uts'
...@@ -34,7 +35,7 @@ export function runTests() : UTSJSONObject { ...@@ -34,7 +35,7 @@ export function runTests() : UTSJSONObject {
const GlobalRes = testGlobal(); const GlobalRes = testGlobal();
const TypeRes = testType(); const TypeRes = testType();
const JSONLargeRes = testJSONLarge(); const JSONLargeRes = testJSONLarge();
const consoleRes = testConsole();
return { return {
Array: ArrayRes, Array: ArrayRes,
Date: DateRes, Date: DateRes,
...@@ -51,6 +52,7 @@ export function runTests() : UTSJSONObject { ...@@ -51,6 +52,7 @@ export function runTests() : UTSJSONObject {
KeyWord: KeyWordRes, KeyWord: KeyWordRes,
ForLoop: ForLoopRes, ForLoop: ForLoopRes,
Global: GlobalRes, Global: GlobalRes,
Type: TypeRes Type: TypeRes,
console:consoleRes
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册