@@ -1548,93 +1548,6 @@ if ( jQuery.support.createHTMLDocument ) {
15481548 } ) ;
15491549}
15501550
1551- QUnit . test ( "jQuery.parseJSON" , function ( assert ) {
1552- assert . expect ( 20 ) ;
1553-
1554- assert . strictEqual ( jQuery . parseJSON ( null ) , null , "primitive null" ) ;
1555- assert . strictEqual ( jQuery . parseJSON ( "0.88" ) , 0.88 , "Number" ) ;
1556- assert . strictEqual (
1557- jQuery . parseJSON ( "\" \\\" \\\\ \\/ \\b \\f \\n \\r \\t \\u007E \\u263a \"" ) ,
1558- " \" \\ / \b \f \n \r \t ~ \u263A " ,
1559- "String escapes"
1560- ) ;
1561- assert . deepEqual ( jQuery . parseJSON ( "{}" ) , { } , "Empty object" ) ;
1562- assert . deepEqual ( jQuery . parseJSON ( "{\"test\":1}" ) , { "test" : 1 } , "Plain object" ) ;
1563- assert . deepEqual ( jQuery . parseJSON ( "[0]" ) , [ 0 ] , "Simple array" ) ;
1564-
1565- assert . deepEqual (
1566- jQuery . parseJSON ( "[ \"string\", -4.2, 2.7180e0, 3.14E-1, {}, [], true, false, null ]" ) ,
1567- [ "string" , - 4.2 , 2.718 , 0.314 , { } , [ ] , true , false , null ] ,
1568- "Array of all data types"
1569- ) ;
1570- assert . deepEqual (
1571- jQuery . parseJSON ( "{ \"string\": \"\", \"number\": 4.2e+1, \"object\": {}," +
1572- "\"array\": [[]], \"boolean\": [ true, false ], \"null\": null }" ) ,
1573- { string : "" , number : 42 , object : { } , array : [ [ ] ] , "boolean" : [ true , false ] , "null" : null } ,
1574- "Dictionary of all data types"
1575- ) ;
1576-
1577- assert . deepEqual ( jQuery . parseJSON ( "\n{\"test\":1}\t" ) , { "test" : 1 } ,
1578- "Leading and trailing whitespace are ignored" ) ;
1579-
1580- assert . throws ( function ( ) {
1581- jQuery . parseJSON ( ) ;
1582- } , null , "Undefined raises an error" ) ;
1583- assert . throws ( function ( ) {
1584- jQuery . parseJSON ( "" ) ;
1585- } , null , "Empty string raises an error" ) ;
1586- assert . throws ( function ( ) {
1587- jQuery . parseJSON ( "''" ) ;
1588- } , null , "Single-quoted string raises an error" ) ;
1589- /*
1590-
1591- // Broken on IE8
1592- assert.throws(function() {
1593- jQuery.parseJSON("\" \\a \"");
1594- }, null, "Invalid string escape raises an error" );
1595-
1596- // Broken on IE8, Safari 5.1 Windows
1597- assert.throws(function() {
1598- jQuery.parseJSON("\"\t\"");
1599- }, null, "Unescaped control character raises an error" );
1600-
1601- // Broken on IE8
1602- assert.throws(function() {
1603- jQuery.parseJSON(".123");
1604- }, null, "Number with no integer component raises an error" );
1605-
1606- */
1607- assert . throws ( function ( ) {
1608- var result = jQuery . parseJSON ( "0101" ) ;
1609-
1610- // Support: IE9+
1611- // Ensure base-10 interpretation on browsers that erroneously accept leading-zero numbers
1612- if ( result === 101 ) {
1613- throw new Error ( "close enough" ) ;
1614- }
1615- } , null , "Leading-zero number raises an error or is parsed as decimal" ) ;
1616- assert . throws ( function ( ) {
1617- jQuery . parseJSON ( "{a:1}" ) ;
1618- } , null , "Unquoted property raises an error" ) ;
1619- assert . throws ( function ( ) {
1620- jQuery . parseJSON ( "{'a':1}" ) ;
1621- } , null , "Single-quoted property raises an error" ) ;
1622- assert . throws ( function ( ) {
1623- jQuery . parseJSON ( "[,]" ) ;
1624- } , null , "Array element elision raises an error" ) ;
1625- assert . throws ( function ( ) {
1626- jQuery . parseJSON ( "{},[]" ) ;
1627- } , null , "Comma expression raises an error" ) ;
1628- assert . throws ( function ( ) {
1629- jQuery . parseJSON ( "[]\n,{}" ) ;
1630- } , null , "Newline-containing comma expression raises an error" ) ;
1631- assert . throws ( function ( ) {
1632- jQuery . parseJSON ( "\"\"\n\"\"" ) ;
1633- } , null , "Automatic semicolon insertion raises an error" ) ;
1634-
1635- assert . strictEqual ( jQuery . parseJSON ( [ 0 ] ) , 0 , "Input cast to string" ) ;
1636- } ) ;
1637-
16381551QUnit . test ( "jQuery.parseXML" , function ( assert ) {
16391552 assert . expect ( 8 ) ;
16401553
0 commit comments