提交 f1e38558 编写于 作者: Z zWX1234017

Change the incorrect input parameter writing method for testing XmlPullParser...

Change the incorrect input parameter writing method for testing XmlPullParser cases in the XML module

https://gitee.com/openharmony/xts_acts/issues/I71WPZSigned-off-by: NzWX1234017 <zhaoduwei3@huawei.com>
上级 034912e8
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
import xml from '@ohos.xml' import xml from '@ohos.xml'
import util from '@ohos.util'
export default function XmlSerializerXmlPullParserTest() { export default function XmlSerializerXmlPullParserTest() {
describe('XmlSerializerXmlPullParserTest', function () { describe('XmlSerializerXmlPullParserTest', function () {
...@@ -1046,13 +1047,9 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1046,13 +1047,9 @@ describe('XmlSerializerXmlPullParserTest', function () {
' </h:tr>' + ' </h:tr>' +
' </h:table>' + ' </h:table>' +
'</note>'; '</note>';
var arrayBuffer = new ArrayBuffer(strXml.length); let textEncoder = new util.TextEncoder();
var bufView = new Uint8Array(arrayBuffer); let arrbuffer = textEncoder.encodeInto(strXml);
var strLen = strXml.length; let that = new xml.XmlPullParser(arrbuffer.buffer, 'UTF-8');
for (var i = 0; i < strLen; ++i) {
bufView[i] = strXml.charCodeAt(i);
}
var that = new xml.XmlPullParser(arrayBuffer, 'UTF-8');
var str = ''; var str = '';
function func2(name, value){ function func2(name, value){
str += name+':'+value; str += name+':'+value;
...@@ -1089,13 +1086,9 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1089,13 +1086,9 @@ describe('XmlSerializerXmlPullParserTest', function () {
' </h:tr>' + ' </h:tr>' +
' </h:table>' + ' </h:table>' +
'</note>'; '</note>';
var arrayBuffer = new ArrayBuffer(strXml.length); let textEncoder = new util.TextEncoder();
var bufView = new Uint8Array(arrayBuffer); let arrbuffer = textEncoder.encodeInto(strXml);
var strLen = strXml.length; let that = new xml.XmlPullParser(arrbuffer.buffer);
for (var i = 0; i < strLen; ++i) {
bufView[i] = strXml.charCodeAt(i);
}
var that = new xml.XmlPullParser(arrayBuffer, 'UTF-8');
var str1 = ''; var str1 = '';
function func1(name, value){ function func1(name, value){
str1 += name + value + ' '; str1 += name + value + ' ';
...@@ -1123,13 +1116,9 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1123,13 +1116,9 @@ describe('XmlSerializerXmlPullParserTest', function () {
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
let arrayBuffer = new ArrayBuffer(strXml.length); let textEncoder = new util.TextEncoder();
let bufView = new Uint8Array(arrayBuffer); let arrbuffer = textEncoder.encodeInto(strXml);
let strLen = strXml.length; let that = new xml.XmlPullParser(arrbuffer.buffer);
for (let tmp = 0; tmp < strLen; ++tmp) {
bufView[tmp] = strXml.charCodeAt(tmp);
}
let that = new xml.XmlPullParser(arrayBuffer);
let str = ""; let str = "";
function func(key, value){ function func(key, value){
str += 'key:' + key + ' value:'+ value.getColumnNumber() + ' '; str += 'key:' + key + ' value:'+ value.getColumnNumber() + ' ';
...@@ -1155,13 +1144,9 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1155,13 +1144,9 @@ describe('XmlSerializerXmlPullParserTest', function () {
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
let arrayBuffer = new ArrayBuffer(strXml.length); let textEncoder = new util.TextEncoder();
let bufView = new Uint8Array(arrayBuffer); let arrbuffer = textEncoder.encodeInto(strXml);
let strLen = strXml.length; let that = new xml.XmlPullParser(arrbuffer.buffer);
for (let tmp = 0; tmp < strLen; ++tmp) {
bufView[tmp] = strXml.charCodeAt(tmp);
}
let that = new xml.XmlPullParser(arrayBuffer);
let str = ""; let str = "";
function func(key, value){ function func(key, value){
str += 'key:' + key + ' value:'+ value.getDepth() + ' '; str += 'key:' + key + ' value:'+ value.getDepth() + ' ';
...@@ -1187,13 +1172,9 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1187,13 +1172,9 @@ describe('XmlSerializerXmlPullParserTest', function () {
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
let arrayBuffer = new ArrayBuffer(strXml.length); let textEncoder = new util.TextEncoder();
let bufView = new Uint8Array(arrayBuffer); let arrbuffer = textEncoder.encodeInto(strXml);
let strLen = strXml.length; let that = new xml.XmlPullParser(arrbuffer.buffer);
for (let tmp = 0; tmp < strLen; ++tmp) {
bufView[tmp] = strXml.charCodeAt(tmp);
}
let that = new xml.XmlPullParser(arrayBuffer);
let str = ""; let str = "";
function func(key, value){ function func(key, value){
str += 'key:'+ key + ' value:' + value.getLineNumber() + ' '; str += 'key:'+ key + ' value:' + value.getLineNumber() + ' ';
...@@ -1219,13 +1200,9 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1219,13 +1200,9 @@ describe('XmlSerializerXmlPullParserTest', function () {
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
let arrayBuffer = new ArrayBuffer(strXml.length); let textEncoder = new util.TextEncoder();
let bufView = new Uint8Array(arrayBuffer); let arrbuffer = textEncoder.encodeInto(strXml);
let strLen = strXml.length; let that = new xml.XmlPullParser(arrbuffer.buffer);
for (let tmp = 0; tmp < strLen; ++tmp) {
bufView[tmp] = strXml.charCodeAt(tmp);
}
let that = new xml.XmlPullParser(arrayBuffer);
let str = ""; let str = "";
function func(key, value){ function func(key, value){
str += 'key:' + key + ' value:' + value.getName() + ' '; str += 'key:' + key + ' value:' + value.getName() + ' ';
...@@ -1251,13 +1228,9 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1251,13 +1228,9 @@ describe('XmlSerializerXmlPullParserTest', function () {
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
let arrayBuffer = new ArrayBuffer(strXml.length); let textEncoder = new util.TextEncoder();
let bufView = new Uint8Array(arrayBuffer); let arrbuffer = textEncoder.encodeInto(strXml);
let strLen = strXml.length; let that = new xml.XmlPullParser(arrbuffer.buffer);
for (let tmp = 0; tmp < strLen; ++tmp) {
bufView[tmp] = strXml.charCodeAt(tmp);
}
let that = new xml.XmlPullParser(arrayBuffer);
let str = ""; let str = "";
function func(key, value){ function func(key, value){
str += 'key:' + key + ' value:'+ value.getNamespace() + ' '; str += 'key:' + key + ' value:'+ value.getNamespace() + ' ';
...@@ -1283,13 +1256,9 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1283,13 +1256,9 @@ describe('XmlSerializerXmlPullParserTest', function () {
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
let arrayBuffer = new ArrayBuffer(strXml.length); let textEncoder = new util.TextEncoder();
let bufView = new Uint8Array(arrayBuffer); let arrbuffer = textEncoder.encodeInto(strXml);
let strLen = strXml.length; let that = new xml.XmlPullParser(arrbuffer.buffer);
for (let tmp = 0; tmp < strLen; ++tmp) {
bufView[tmp] = strXml.charCodeAt(tmp);
}
let that = new xml.XmlPullParser(arrayBuffer);
let str = ""; let str = "";
function func(key, value){ function func(key, value){
str += 'key:'+key+' value:'+ value.getPrefix() + ' '; str += 'key:'+key+' value:'+ value.getPrefix() + ' ';
...@@ -1315,13 +1284,9 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1315,13 +1284,9 @@ describe('XmlSerializerXmlPullParserTest', function () {
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
let arrayBuffer = new ArrayBuffer(strXml.length); let textEncoder = new util.TextEncoder();
let bufView = new Uint8Array(arrayBuffer); let arrbuffer = textEncoder.encodeInto(strXml);
let strLen = strXml.length; let that = new xml.XmlPullParser(arrbuffer.buffer);
for (let tmp = 0; tmp < strLen; ++tmp) {
bufView[tmp] = strXml.charCodeAt(tmp);
}
let that = new xml.XmlPullParser(arrayBuffer);
let str = ""; let str = "";
function func(key, value){ function func(key, value){
str += 'key:' + key +' value:' + value.getText() + ' '; str += 'key:' + key +' value:' + value.getText() + ' ';
...@@ -1347,13 +1312,9 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1347,13 +1312,9 @@ describe('XmlSerializerXmlPullParserTest', function () {
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
let arrayBuffer = new ArrayBuffer(strXml.length); let textEncoder = new util.TextEncoder();
let bufView = new Uint8Array(arrayBuffer); let arrbuffer = textEncoder.encodeInto(strXml);
let strLen = strXml.length; let that = new xml.XmlPullParser(arrbuffer.buffer);
for (let tmp = 0; tmp < strLen; ++tmp) {
bufView[tmp] = strXml.charCodeAt(tmp);
}
let that = new xml.XmlPullParser(arrayBuffer);
let str = ""; let str = "";
function func(key, value){ function func(key, value){
str += 'key:' + key +' value:' + value.isEmptyElementTag() + ' '; str += 'key:' + key +' value:' + value.isEmptyElementTag() + ' ';
...@@ -1380,13 +1341,9 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1380,13 +1341,9 @@ describe('XmlSerializerXmlPullParserTest', function () {
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
let arrayBuffer = new ArrayBuffer(strXml.length); let textEncoder = new util.TextEncoder();
let bufView = new Uint8Array(arrayBuffer); let arrbuffer = textEncoder.encodeInto(strXml);
let strLen = strXml.length; let that = new xml.XmlPullParser(arrbuffer.buffer);
for (let tmp = 0; tmp < strLen; ++tmp) {
bufView[tmp] = strXml.charCodeAt(tmp);
}
let that = new xml.XmlPullParser(arrayBuffer);
let str = ""; let str = "";
function func(key, value){ function func(key, value){
str += 'key:' + key +' value:' + value.isWhitespace() + ' '; str += 'key:' + key +' value:' + value.isWhitespace() + ' ';
...@@ -1413,13 +1370,9 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1413,13 +1370,9 @@ describe('XmlSerializerXmlPullParserTest', function () {
' <todo>Work</todo>' + ' <todo>Work</todo>' +
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
let arrayBuffer = new ArrayBuffer(strXml.length); let textEncoder = new util.TextEncoder();
let bufView = new Uint8Array(arrayBuffer); let arrbuffer = textEncoder.encodeInto(strXml);
let strLen = strXml.length; let that = new xml.XmlPullParser(arrbuffer.buffer);
for (let tmp = 0; tmp < strLen; ++tmp) {
bufView[tmp] = strXml.charCodeAt(tmp);
}
let that = new xml.XmlPullParser(arrayBuffer);
let str = ""; let str = "";
function func(key, value){ function func(key, value){
str += 'key:' + key +' value:' + value.getAttributeCount() + ' '; str += 'key:' + key +' value:' + value.getAttributeCount() + ' ';
...@@ -1756,13 +1709,9 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1756,13 +1709,9 @@ describe('XmlSerializerXmlPullParserTest', function () {
' </h:tr>' + ' </h:tr>' +
' </h:table>' + ' </h:table>' +
'</note>'; '</note>';
var arrayBuffer = new ArrayBuffer(strXml.length*2); let textEncoder = new util.TextEncoder();
var bufView = new Uint8Array(arrayBuffer); let arrbuffer = textEncoder.encodeInto(strXml);
var strLen = strXml.length; let that = new xml.XmlPullParser(arrbuffer.buffer, 'UTF-8');
for (var i = 0; i < strLen; ++i) {
bufView[i] = strXml.charCodeAt(i);
}
var that = new xml.XmlPullParser(arrayBuffer, 'UTF-8');
var str1 = ''; var str1 = '';
function func1(name, value){ function func1(name, value){
str1 += name+':'+value; str1 += name+':'+value;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册