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

console.log 完善示例

上级 8cff243d
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<script> <script>
import { getLog,logObjectTest,logClassTest,logFunctionTest,logFileTest,logDateTest } from '../../uni_modules/uts-api-test' import { getLog,logObjectTest,logClassTest,logFunctionTest,logFileTest,logDateTest,logUTSJSONObjectTest } from '../../uni_modules/uts-api-test'
export default { export default {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<script> <script>
import { getLog,logObjectTest,logClassTest,logFunctionTest,logFileTest,logDateTest } from '../../uni_modules/uts-api-test' import { getLog,logObjectTest,logClassTest,logFunctionTest,logFileTest,logDateTest,frequentlyObjectTest } from '../../uni_modules/uts-api-test'
export default { export default {
...@@ -69,6 +69,10 @@ ...@@ -69,6 +69,10 @@
return; return;
} }
if(!frequentlyObjectTest()){
this.testRet = "测试失败"
return;
}
this.testRet = "测试完成" this.testRet = "测试完成"
} }
......
...@@ -17,7 +17,7 @@ export const getLog : GetLog = function (param : Any|null) : string { ...@@ -17,7 +17,7 @@ export const getLog : GetLog = function (param : Any|null) : string {
let jsonLog = allLog let jsonLog = allLog
jsonLog = jsonLog.replace("---BEGIN:CONSOLE---", "") jsonLog = jsonLog.replace("---BEGIN:CONSOLE---", "")
jsonLog = jsonLog.replace("---END:CONSOLE---", "") jsonLog = jsonLog.replace("---END:CONSOLE---", "")
let jsonArrayObj = JSON.parse<UTSArray<UTSJSONObject>>(jsonLog) let jsonArrayObj = JSON.parse<Array<UTSJSONObject>>(jsonLog)
return jsonArrayObj![0].toJSONString() return jsonArrayObj![0].toJSONString()
} }
...@@ -36,6 +36,28 @@ class C { ...@@ -36,6 +36,28 @@ class C {
} }
} }
/**
* 高频对象测试,主要是系统组件对象
*/
export function frequentlyObjectTest():boolean{
let typeLogRet = getLog(UTSAndroid.getUniActivity())
console.log(typeLogRet)
let typeLogObj = JSON.parseObject(typeLogRet)!
// let typeLogObjPos = typeLogObj.getJSON("__$originalPosition")!
// if("ParamOptions" != typeLogObjPos['name']){
// return false
// }
// /**
// * 编译出来的位置信息可能有差异,排除单独验证后,排除掉这个字段
// */
// typeLogObj.set("__$originalPosition","")
// console.log(typeLogObj.toJSONString())
return true
}
export function logObjectTest():string{ export function logObjectTest():string{
let ret : ParamOptions = { let ret : ParamOptions = {
title: "logObjectTest", title: "logObjectTest",
...@@ -72,6 +94,27 @@ export function logDateTest():string{ ...@@ -72,6 +94,27 @@ export function logDateTest():string{
return getLog(new Date('1998-08-08')) return getLog(new Date('1998-08-08'))
} }
export function logUTSJSONObjectTest():string{
let classLogRet = getLog({a:1})
let classLogObj = JSON.parseObject(classLogRet)!
let classLogObjPos = classLogObj.getJSON("__$originalPosition")
if(classLogObjPos == null){
return ""
}
if("UTSJSONObject" != classLogObjPos['name']){
return ""
}
classLogObj.set("__$originalPosition","")
return classLogObj.toJSONString()
}
export function logClassTest():string{ export function logClassTest():string{
let c = new C() let c = new C()
c.name="ccc" c.name="ccc"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册