diff --git a/commonlibrary/ets_utils/convertxml_lib_standard/src/main/js/test/convertxml.test.js b/commonlibrary/ets_utils/convertxml_lib_standard/src/main/js/test/convertxml.test.js index 24477d2bceb797b0c713ec8a94cd6d82e0a8f98d..e66c95cf6f87985a9e2bcdbf78755f04548a19a5 100644 --- a/commonlibrary/ets_utils/convertxml_lib_standard/src/main/js/test/convertxml.test.js +++ b/commonlibrary/ets_utils/convertxml_lib_standard/src/main/js/test/convertxml.test.js @@ -20,7 +20,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert001 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert001', 0, function () { let xml = @@ -61,7 +60,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert002 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert002', 0, function () { let xml = @@ -102,7 +100,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert003 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert003', 0, function () { let xml = @@ -141,7 +138,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert004 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert004', 0, function () { let xml = @@ -184,7 +180,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert005 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert005', 0, function () { let xml = @@ -223,7 +218,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert006 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert006', 0, function () { let xml = @@ -265,7 +259,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert007 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert007', 0, function () { let xml = @@ -307,7 +300,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert008 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert008', 0, function () { let xml = @@ -349,7 +341,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert09 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert09', 0, function () { let xml = @@ -391,7 +382,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert010 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert010', 0, function () { let xml = @@ -426,7 +416,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert011 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert011', 0, function () { let xml = @@ -467,7 +456,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert012 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert012', 0, function () { let xml = @@ -512,7 +500,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert013 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert013', 0, function () { let xml = @@ -557,7 +544,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert014 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert014', 0, function () { let xml = @@ -598,7 +584,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert015 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert015', 0, function () { let xml = @@ -642,7 +627,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert016 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert016', 0, function () { let xml = @@ -686,7 +670,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert017 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert017', 0, function () { let xml = @@ -732,7 +715,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert018 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert018', 0, function () { let xml = @@ -773,7 +755,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert019 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert019', 0, function () { let xml = @@ -814,7 +795,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert020 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert020', 0, function () { let xml = @@ -855,7 +835,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert021 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert021', 0, function () { let xml = ''; @@ -873,7 +852,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert022 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert022', 0, function () { let xml = ''; @@ -892,7 +870,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert023 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert023', 0, function () { let xml = '\n'; @@ -910,7 +887,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert024 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert024', 0, function () { let xml = ''; @@ -930,7 +906,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert025 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert025', 0, function () { let xml = ''; @@ -953,7 +928,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert026 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert026', 0, function () { let xml = ''; @@ -976,7 +950,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert027 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert027', 0, function () { let xml = '\n'; @@ -1002,7 +975,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert028 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert028', 0, function () { let xml = ' \t ]]>'; @@ -1024,7 +996,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert029 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert029', 0, function () { let xml = ' " and & \t ]]>'; @@ -1052,7 +1023,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert030 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert030', 0, function () { let xml = ''; @@ -1071,7 +1041,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert031 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert031', 0, function () { let xml = '\n'; @@ -1092,7 +1061,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert032 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert032', 0, function () { let xml = '\n'; @@ -1113,7 +1081,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert033 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert033', 0, function () { let xml = ''; @@ -1133,7 +1100,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert034 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert034', 0, function () { let xml = ''; @@ -1154,7 +1120,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert035 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert035', 0, function () { let xml = ' \t Hi \t '; @@ -1176,7 +1141,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert036 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert036', 0, function () { let xml = ' Hi There \t '; @@ -1198,7 +1162,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert037 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert037', 0, function () { let xml = '\n\v\n'; @@ -1219,7 +1182,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert038 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert038', 0, function () { let xml = '\n\v\n\v\v\n\v\n'; @@ -1242,7 +1204,6 @@ describe('XmlTest', function () { /** * @tc.name: testConvert039 * @tc.desc: To convert XML text to JavaScript object. - * @tc.author: lihucheng */ it('testConvert039', 0, function () { let xml = @@ -1281,4 +1242,59 @@ describe('XmlTest', function () { '"_text":"Play"}]}]}]}' expect(result).assertEqual(str1); }) + + /** + * @tc.name: testBusinessError001 + * @tc.desc: To convert XML text to JavaScript object. + */ + it('testBusinessError001', 0, function () { + try { + let xml = 123; + let conv = new convertxml.ConvertXML(); + let options = {trim : false, declarationKey:"_declaration", + instructionKey : "_instruction", attributesKey : "_attributes", + textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype", + commentKey : "_comment", parentKey : "_parent", typeKey : "_type", + nameKey : "_name", elementsKey : "_elements"} + conv.convertToJSObject(xml, options); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 123 must be string") + } + }) + + /** + * @tc.name: testBusinessError002 + * @tc.desc: To convert XML text to JavaScript object. + */ + it('testBusinessError002', 0, function () { + try { + let xml = + '' + + '' + + ' Happy' + + ' Work' + + ' Play' + + ''; + let conv = new convertxml.ConvertXML(); + let options = 123 + conv.convertToJSObject(xml, options); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 123 must be object") + } + }) + + /** + * @tc.name: testBusinessError003 + * @tc.desc: To convert XML text to JavaScript object. + */ + it('testBusinessError003', 0, function () { + try { + let xml = 111; + let conv = new convertxml.ConvertXML(); + let options = 123 + conv.convertToJSObject(xml, options); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 111 must be string") + } + }) })} diff --git a/commonlibrary/ets_utils/xml_lib_standard/src/main/js/test/xml.test.js b/commonlibrary/ets_utils/xml_lib_standard/src/main/js/test/xml.test.js index 004fc7efbb44aff7814a2b3828340220b6c687a3..c044c9fb1cf94d8e451a3e075f254039f87a0fa4 100644 --- a/commonlibrary/ets_utils/xml_lib_standard/src/main/js/test/xml.test.js +++ b/commonlibrary/ets_utils/xml_lib_standard/src/main/js/test/xml.test.js @@ -20,7 +20,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetDeclaration001 * @tc.desc: Writes xml declaration with encoding. For example: . - * @tc.author: lihucheng */ it('testSetDeclaration001', 0, function () { var arrayBuffer = new ArrayBuffer(2048); @@ -38,7 +37,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetDeclaration002 * @tc.desc: Writes xml declaration with encoding. For example: . - * @tc.author: lihucheng */ it('testSetDeclaration002', 0, function () { var arrayBuffer = new ArrayBuffer(2048); @@ -56,7 +54,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetDeclaration003 * @tc.desc: Writes xml declaration with encoding. For example: . - * @tc.author: lihucheng */ it('testSetDeclaration003', 0, function () { var arrayBuffer = new ArrayBuffer(2048); @@ -74,7 +71,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetDeclaration004 * @tc.desc: Writes xml declaration with encoding. For example: . - * @tc.author: lihucheng */ it('testSetDeclaration004', 0, function () { var arrayBuffer = new ArrayBuffer(2048); @@ -92,7 +88,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetDeclaration005 * @tc.desc: Writes xml declaration with encoding. For example: . - * @tc.author: lihucheng */ it('testSetDeclaration005', 0, function () { var arrayBuffer = new ArrayBuffer(2048); @@ -110,7 +105,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testStartElement001 * @tc.desc: Writes an elemnet start tag with the given name. - * @tc.author: lihucheng */ it('testStartElement001', 0, function () { const myMAX = 2048; @@ -130,7 +124,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testStartElement002 * @tc.desc: Writes an elemnet start tag with the given name. - * @tc.author: lihucheng */ it('testStartElement002', 0, function () { const myMAX = 2048; @@ -152,7 +145,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testStartElement003 * @tc.desc: Writes an elemnet start tag with the given name. - * @tc.author: lihucheng */ it('testStartElement003', 0, function () { const myMAX = 2048; @@ -174,7 +166,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testStartElement004 * @tc.desc: Writes an elemnet start tag with the given name. - * @tc.author: lihucheng */ it('testStartElement004', 0, function () { const myMAX = 2048; @@ -198,7 +189,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testStartElement005 * @tc.desc: Writes an elemnet start tag with the given name. - * @tc.author: lihucheng */ it('testStartElement005', 0, function () { const myMAX = 2048; @@ -222,7 +212,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetAttributes001 * @tc.desc: Write an attribute. - * @tc.author: lihucheng */ it('testSetAttributes001', 0, function () { const myMAX = 2048; @@ -243,7 +232,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetAttributes002 * @tc.desc: Write an attribute. - * @tc.author: lihucheng */ it('testSetAttributes002', 0, function () { const myMAX = 2048; @@ -265,7 +253,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetAttributes003 * @tc.desc: Write an attribute. - * @tc.author: lihucheng */ it('testSetAttributes003', 0, function () { const myMAX = 2048; @@ -288,7 +275,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetAttributes004 * @tc.desc: Write an attribute. - * @tc.author: lihucheng */ it('testSetAttributes004', 0, function () { const myMAX = 2048; @@ -312,7 +298,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetAttributes005 * @tc.desc: Write an attribute. - * @tc.author: lihucheng */ it('testSetAttributes005', 0, function () { const myMAX = 2048; @@ -336,7 +321,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEndElement001 * @tc.desc: Writes end tag of the element. - * @tc.author: lihucheng */ it('testEndElement001', 0, function () { const myMAX = 2048; @@ -356,7 +340,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEndElement002 * @tc.desc: Writes end tag of the element. - * @tc.author: lihucheng */ it('testEndElement002', 0, function () { const myMAX = 2048; @@ -377,7 +360,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEndElement003 * @tc.desc: Writes end tag of the element. - * @tc.author: lihucheng */ it('testEndElement003', 0, function () { const myMAX = 2048; @@ -398,7 +380,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEndElement004 * @tc.desc: Writes end tag of the element. - * @tc.author: lihucheng */ it('testEndElement004', 0, function () { const myMAX = 2048; @@ -420,7 +401,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEndElement005 * @tc.desc: Writes end tag of the element. - * @tc.author: lihucheng */ it('testEndElement005', 0, function () { const myMAX = 2048; @@ -441,7 +421,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetText001 * @tc.desc: Writes the text. - * @tc.author: lihucheng */ it('testSetText001', 0, function () { const myMAX = 2048; @@ -463,7 +442,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetText002 * @tc.desc: Writes the text. - * @tc.author: lihucheng */ it('testSetText002', 0, function () { const myMAX = 2048; @@ -485,7 +463,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetText003 * @tc.desc: Writes the text. - * @tc.author: lihucheng */ it('testSetText003', 0, function () { const myMAX = 2048; @@ -507,7 +484,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetText004 * @tc.desc: Writes the text. - * @tc.author: lihucheng */ it('testSetText004', 0, function () { const myMAX = 2048; @@ -529,7 +505,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetText005 * @tc.desc: Writes the text. - * @tc.author: lihucheng */ it('testSetText005', 0, function () { const myMAX = 2048; @@ -551,7 +526,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testAddEmptyElement001 * @tc.desc: Add an empty element. - * @tc.author: lihucheng */ it('testAddEmptyElement001', 0, function () { const myMAX = 2048; @@ -572,7 +546,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testAddEmptyElement002 * @tc.desc: Add an empty element. - * @tc.author: lihucheng */ it('testAddEmptyElement002', 0, function () { const myMAX = 2048; @@ -593,7 +566,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testAddEmptyElement003 * @tc.desc: Add an empty element. - * @tc.author: lihucheng */ it('testAddEmptyElement003', 0, function () { const myMAX = 2048; @@ -614,7 +586,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testAddEmptyElement004 * @tc.desc: Add an empty element. - * @tc.author: lihucheng */ it('testAddEmptyElement004', 0, function () { const myMAX = 2048; @@ -633,7 +604,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testAddEmptyElement005 * @tc.desc: Add an empty element. - * @tc.author: lihucheng */ it('testAddEmptyElement005', 0, function () { const myMAX = 2048; @@ -655,7 +625,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetNamespace001 * @tc.desc: Writes the namespace of the current element tag. - * @tc.author: lihucheng */ it('testSetNamespace001', 0, function () { const myMAX = 2048; @@ -677,7 +646,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetNamespace002 * @tc.desc: Writes the namespace of the current element tag. - * @tc.author: lihucheng */ it('testSetNamespace002', 0, function () { const myMAX = 2048; @@ -699,7 +667,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetNamespace003 * @tc.desc: Writes the namespace of the current element tag. - * @tc.author: lihucheng */ it('testSetNamespace003', 0, function () { const myMAX = 2048; @@ -721,7 +688,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetNamespace004 * @tc.desc: Writes the namespace of the current element tag. - * @tc.author: lihucheng */ it('testSetNamespace004', 0, function () { const myMAX = 2048; @@ -746,7 +712,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetNamespace005 * @tc.desc: Writes the namespace of the current element tag. - * @tc.author: lihucheng */ it('testSetNamespace005', 0, function () { const myMAX = 2048; @@ -771,7 +736,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetComment001 * @tc.desc: Writes the comment. - * @tc.author: lihucheng */ it('testSetComment001', 0, function () { const myMAX = 2048; @@ -792,7 +756,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetComment002 * @tc.desc: Writes the comment. - * @tc.author: lihucheng */ it('testSetComment002', 0, function () { const myMAX = 2048; @@ -813,7 +776,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetComment003 * @tc.desc: Writes the comment. - * @tc.author: lihucheng */ it('testSetComment003', 0, function () { const myMAX = 2048; @@ -832,7 +794,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetComment004 * @tc.desc: Writes the comment. - * @tc.author: lihucheng */ it('testSetComment004', 0, function () { const myMAX = 2048; @@ -851,7 +812,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetComment005 * @tc.desc: Writes the comment. - * @tc.author: lihucheng */ it('testSetComment005', 0, function () { const myMAX = 2048; @@ -872,7 +832,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetDocType001 * @tc.desc: Writes the DOCTYPE. - * @tc.author: lihucheng */ it('testSetDocType001', 0, function () { const myMAX = 2048; @@ -891,7 +850,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetDocType002 * @tc.desc: Writes the DOCTYPE. - * @tc.author: lihucheng */ it('testSetDocType002', 0, function () { const myMAX = 2048; @@ -910,7 +868,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetDocType003 * @tc.desc: Writes the DOCTYPE. - * @tc.author: lihucheng */ it('testSetDocType003', 0, function () { const myMAX = 2048; @@ -931,7 +888,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetDocType004 * @tc.desc: Writes the DOCTYPE. - * @tc.author: lihucheng */ it('testSetDocType004', 0, function () { const myMAX = 2048; @@ -952,7 +908,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetDocType005 * @tc.desc: Writes the DOCTYPE. - * @tc.author: lihucheng */ it('testSetDocType005', 0, function () { const myMAX = 2048; @@ -973,7 +928,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetCDATA001 * @tc.desc: Writes the CDATA. - * @tc.author: lihucheng */ it('testSetCDATA001', 0, function () { const myMAX = 2048; @@ -992,7 +946,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetCDATA002 * @tc.desc: Writes the CDATA. - * @tc.author: lihucheng */ it('testSetCDATA002', 0, function () { const myMAX = 2048; @@ -1011,7 +964,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetCDATA003 * @tc.desc: Writes the CDATA. - * @tc.author: lihucheng */ it('testSetCDATA003', 0, function () { const myMAX = 2048; @@ -1032,7 +984,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetCDATA004 * @tc.desc: Writes the CDATA. - * @tc.author: lihucheng */ it('testSetCDATA004', 0, function () { const myMAX = 2048; @@ -1053,7 +1004,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testSetCDATA005 * @tc.desc: Writes the CDATA. - * @tc.author: lihucheng */ it('testSetCDATA005', 0, function () { const myMAX = 2048; @@ -1074,7 +1024,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testParse001 * @tc.desc: Starts parsing the XML file. - * @tc.author: lihucheng */ it('testParse001', 0, function () { var strXml = @@ -1143,7 +1092,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testParse002 * @tc.desc: Starts parsing the XML file. - * @tc.author: lihucheng */ it('testParse002', 0, function () { var strXml = @@ -1209,7 +1157,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testParse003 * @tc.desc: Starts parsing the XML file. - * @tc.author: lihucheng */ it('testParse003', 0, function () { var strXml = @@ -1276,7 +1223,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testParse004 * @tc.desc: Starts parsing the XML file. - * @tc.author: lihucheng */ it('testParse004', 0, function () { var strXml = @@ -1320,7 +1266,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testParse005 * @tc.desc: Starts parsing the XML file. - * @tc.author: lihucheng */ it('testParse005', 0, function () { var strXml = @@ -1364,7 +1309,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEventType001 * @tc.desc: Gets the START_DOCUMENT of EventType. - * @tc.author: lihucheng */ it('testEventType001', 0, function () { var event = xml.EventType.START_DOCUMENT; @@ -1374,7 +1318,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEventType002 * @tc.desc: Gets the END_DOCUMENT of EventType. - * @tc.author: lihucheng */ it('testEventType002', 0, function () { var event = xml.EventType.END_DOCUMENT; @@ -1384,7 +1327,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEventType003 * @tc.desc: Gets the START_TAG of EventType. - * @tc.author: lihucheng */ it('testEventType003', 0, function () { var event = xml.EventType.START_TAG; @@ -1394,7 +1336,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEventType004 * @tc.desc: Gets the END_TAG of EventType. - * @tc.author: lihucheng */ it('testEventType004', 0, function () { var event = xml.EventType.END_TAG; @@ -1404,7 +1345,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEventType005 * @tc.desc: Gets the TEXT of EventType. - * @tc.author: lihucheng */ it('testEventType005', 0, function () { var event = xml.EventType.TEXT; @@ -1414,7 +1354,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEventType006 * @tc.desc: Gets the CDSECT of EventType. - * @tc.author: lihucheng */ it('testEventType006', 0, function () { var event = xml.EventType.CDSECT; @@ -1424,7 +1363,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEventType007 * @tc.desc: Gets the COMMENT of EventType. - * @tc.author: lihucheng */ it('testEventType007', 0, function () { var event = xml.EventType.COMMENT; @@ -1434,7 +1372,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEventType008 * @tc.desc: Gets the DOCDECL of EventType. - * @tc.author: lihucheng */ it('testEventType008', 0, function () { var event = xml.EventType.DOCDECL; @@ -1444,7 +1381,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEventType009 * @tc.desc: Gets the INSTRUCTION of EventType. - * @tc.author: lihucheng */ it('testEventType009', 0, function () { var event = xml.EventType.INSTRUCTION; @@ -1454,7 +1390,6 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEventType010 * @tc.desc: Gets the ENTITY_REFERENCE of EventType. - * @tc.author: lihucheng */ it('testEventType010', 0, function () { var event = xml.EventType.ENTITY_REFERENCE; @@ -1464,10 +1399,252 @@ describe('XmlSerializerXmlPullParserTest', function () { /** * @tc.name: testEventType011 * @tc.desc: Gets the WHITESPACE of EventType. - * @tc.author: lihucheng */ it('testEventType011', 0, function () { var event = xml.EventType.WHITESPACE; expect(event).assertEqual(10) }) + + /** + * @tc.name: testBusinessError001 + * @tc.desc: To XML text to JavaScript object. + */ + it('testBusinessError001', 0, function () { + try { + new xml.XmlSerializer(123,"utf-8"); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 123 must be object") + } + }) + + /** + * @tc.name: testBusinessError002 + * @tc.desc: To XML text to JavaScript object. + */ + it('testBusinessError002', 0, function () { + try { + var arrayBuffer = new ArrayBuffer(2048); + new xml.XmlSerializer(arrayBuffer,123); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 123 must be string") + } + }) + + /** + * @tc.name: testBusinessError003 + * @tc.desc: To XML text to JavaScript object. + */ + it('testBusinessError003', 0, function () { + try { + var arrayBuffer = new ArrayBuffer(2048); + var thatSer = new xml.XmlSerializer(arrayBuffer,"utf-8"); + thatSer.startElement(111); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 111 must be string") + } + }) + + /** + * @tc.name: testBusinessError004 + * @tc.desc: To XML text to JavaScript object. + */ + it('testBusinessError004', 0, function () { + try { + var arrayBuffer = new ArrayBuffer(2048); + var thatSer = new xml.XmlSerializer(arrayBuffer,"utf-8"); + thatSer.startElement("note"); + thatSer.setAttributes(111, "high1"); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 111 must be string") + } + }) + + /** + * @tc.name: testBusinessError005 + * @tc.desc: To XML text to JavaScript object. + */ + it('testBusinessError005', 0, function () { + try { + var arrayBuffer = new ArrayBuffer(2048); + var thatSer = new xml.XmlSerializer(arrayBuffer,"utf-8"); + thatSer.startElement("note"); + thatSer.setAttributes("importance1", 111); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 111 must be string") + } + }) + + /** + * @tc.name: testBusinessError006 + * @tc.desc: To XML text to JavaScript object. + */ + it('testBusinessError006', 0, function () { + try { + var arrayBuffer = new ArrayBuffer(2048); + var thatSer = new xml.XmlSerializer(arrayBuffer,"utf-8"); + thatSer.startElement("note"); + thatSer.setAttributes("importance", "high"); + thatSer.setText(111); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 111 must be string") + } + }) + + /** + * @tc.name: testBusinessError007 + * @tc.desc: To XML text to JavaScript object. + */ + it('testBusinessError007', 0, function () { + try { + var arrayBuffer = new ArrayBuffer(2048); + var thatSer = new xml.XmlSerializer(arrayBuffer,"utf-8"); + thatSer.startElement("note"); + thatSer.addEmptyElement(111); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 111 must be string") + } + }) + + /** + * @tc.name: testBusinessError008 + * @tc.desc: To XML text to JavaScript object. + */ + it('testBusinessError008', 0, function () { + try { + var arrayBuffer = new ArrayBuffer(2048); + var thatSer = new xml.XmlSerializer(arrayBuffer,"utf-8"); + thatSer.setDeclaration(); + thatSer.setNamespace(111, "http://www.w3.org/TR/html4/"); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 111 must be string") + } + }) + + /** + * @tc.name: testBusinessError009 + * @tc.desc: To XML text to JavaScript object. + */ + it('testBusinessError009', 0, function () { + try { + var arrayBuffer = new ArrayBuffer(2048); + var thatSer = new xml.XmlSerializer(arrayBuffer,"utf-8"); + thatSer.setDeclaration(); + thatSer.setNamespace("h", 111); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 111 must be string") + } + }) + + /** + * @tc.name: testBusinessError010 + * @tc.desc: To XML text to JavaScript object. + */ + it('testBusinessError010', 0, function () { + try { + var arrayBuffer = new ArrayBuffer(2048); + var thatSer = new xml.XmlSerializer(arrayBuffer,"utf-8"); + thatSer.startElement("note"); + thatSer.setComment(111); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 111 must be string") + } + }) + + /** + * @tc.name: testBusinessError011 + * @tc.desc: To XML text to JavaScript object. + */ + it('testBusinessError0011', 0, function () { + try { + var arrayBuffer = new ArrayBuffer(2048); + var thatSer = new xml.XmlSerializer(arrayBuffer,"utf-8"); + thatSer.setDocType(111); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 111 must be string") + } + }) + + /** + * @tc.name: testBusinessError012 + * @tc.desc: To XML text to JavaScript object. + */ + it('testBusinessError0012', 0, function () { + try { + var arrayBuffer = new ArrayBuffer(2048); + var thatSer = new xml.XmlSerializer(arrayBuffer,"utf-8"); + thatSer.setCDATA(111) + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 111 must be string") + } + }) + + /** + * @tc.name: testBusinessError013 + * @tc.desc: To XML text to JavaScript object. + */ + it('testBusinessError0013', 0, function () { + try { + new xml.XmlPullParser(111, 'UTF-8'); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 111 must be object") + } + }) + + /** + * @tc.name: testBusinessError014 + * @tc.desc: To XML text to JavaScript object. + */ + it('testBusinessError0014', 0, function () { + try { + var arrayBuffer = new ArrayBuffer(2048); + new xml.XmlPullParser(arrayBuffer, 111); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 111 must be string") + } + }) + + /** + * @tc.name: testBusinessError015 + * @tc.desc: To XML text to JavaScript object. + */ + it('testBusinessError0015', 0, function () { + try { + var strXml = + '' + + ']>' + + '' + + ' ' + + ' ' + + ' John & Hans' + + ' Happy' + + ' Happy' + + ' Work' + + ' Play' + + ' ' + + ' ' + + ' ' + + ' ' + + ' Apples' + + ' Bananas' + + ' ' + + ' ' + + ''; + 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'); + var str1 = ''; + function func1(name, value){ + str1 += name+':'+value; + return true; + } + var options = {supportDoctype:true, ignoreNameSpace:true, tagValueCallbackFunction:func1} + that.parse(options); + } catch (e) { + expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 111 must be object") + } + }) })}