...
 
Commits (2)
    https://gitcode.net/dcloud/hello-uts/-/commit/eef491bf9de795636f6c51ccf4f8eec7975e1953 增加console.log 测试示例 2024-05-15T18:31:07+08:00 duqingquan duqingquan@dcloud.io https://gitcode.net/dcloud/hello-uts/-/commit/af83de43a70bacb9681147b937c22add07fd3433 Merge branch 'dev' of gitcode.net:dcloud/hello-uts into dev 2024-05-15T18:31:46+08:00 duqingquan duqingquan@dcloud.io
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'
import { testError } from './Error.uts'
import { testKeyWord } from './KeyWord.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 { testMap } from './Map.uts'
import { testSet } from './Set.uts'
......@@ -34,7 +35,7 @@ export function runTests() : UTSJSONObject {
const GlobalRes = testGlobal();
const TypeRes = testType();
const JSONLargeRes = testJSONLarge();
const consoleRes = testConsole();
return {
Array: ArrayRes,
Date: DateRes,
......@@ -51,6 +52,7 @@ export function runTests() : UTSJSONObject {
KeyWord: KeyWordRes,
ForLoop: ForLoopRes,
Global: GlobalRes,
Type: TypeRes
Type: TypeRes,
console:consoleRes
}
}
\ No newline at end of file