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