OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../resources/js-test.js"></script> | 2 <script src="../../resources/js-test.js"></script> |
3 <script> | 3 <script> |
4 description("Exercise WebIDL type conversions."); | 4 description("Exercise WebIDL type conversions."); |
5 | 5 |
6 quiet = true; | 6 quiet = true; |
7 evalAndLog("converter = window.internals.typeConversions()"); | 7 evalAndLog("converter = window.internals.typeConversions()"); |
8 debug(""); | 8 debug(""); |
9 | 9 |
10 function verifyAttribute(attribute) | 10 function verifyAttribute(attribute) |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 debug(""); | 582 debug(""); |
583 | 583 |
584 evalAndLog("converter.testByteString = '!@#123ABCabc\\x00\\x80\\xFF\\r\\n\\t'"); | 584 evalAndLog("converter.testByteString = '!@#123ABCabc\\x00\\x80\\xFF\\r\\n\\t'"); |
585 shouldBeEqualToString("converter.testByteString", "!@#123ABCabc\x00\x80\xFF\r\n\
t"); | 585 shouldBeEqualToString("converter.testByteString", "!@#123ABCabc\x00\x80\xFF\r\n\
t"); |
586 shouldThrow("converter.testByteString = '\\u0100'"); | 586 shouldThrow("converter.testByteString = '\\u0100'"); |
587 shouldThrow("converter.testByteString = {toString: function() { throw Error(); }
}"); | 587 shouldThrow("converter.testByteString = {toString: function() { throw Error(); }
}"); |
588 shouldBeEqualToString("converter.testByteString", "!@#123ABCabc\x00\x80\xFF\r\n\
t"); | 588 shouldBeEqualToString("converter.testByteString", "!@#123ABCabc\x00\x80\xFF\r\n\
t"); |
589 ["true", "123", "null", "undefined"].forEach(function(value) { | 589 ["true", "123", "null", "undefined"].forEach(function(value) { |
590 evalAndLog("converter.testByteString = " + value); | 590 evalAndLog("converter.testByteString = " + value); |
591 shouldBeEqualToString("converter.testByteString", value); | 591 shouldBeEqualToString("converter.testByteString", value); |
592 shouldBeEqualToString("converter.testByteStringTreatReturnedNullStringAsNull
Attribute", value); | |
593 shouldBeEqualToString("converter.testByteStringTreatReturnedNullStringAsUnde
finedAttribute", value); | |
594 shouldBeEqualToString("converter.getTestByteStringTreatReturnedNullStringAsN
ullMethod()", value); | |
595 shouldBeEqualToString("converter.getTestByteStringTreatReturnedNullStringAsU
ndefinedMethod()", value); | |
596 }); | 592 }); |
597 shouldNotThrow("converter.setTestByteString('abc')"); | 593 shouldNotThrow("converter.setTestByteString('abc')"); |
598 shouldNotThrow("converter.setTestByteStringDefaultNull('abc')"); | 594 shouldNotThrow("converter.setTestByteStringDefaultNull('abc')"); |
599 shouldThrow("converter.setTestByteString('\\u0100')"); | 595 shouldThrow("converter.setTestByteString('\\u0100')"); |
600 shouldThrow("converter.setTestByteStringDefaultNull('\\u0100')"); | 596 shouldThrow("converter.setTestByteStringDefaultNull('\\u0100')"); |
601 shouldThrow("converter.setTestByteString()"); | 597 shouldThrow("converter.setTestByteString()"); |
602 shouldNotThrow("converter.setTestByteStringDefaultNull()"); | 598 shouldNotThrow("converter.setTestByteStringDefaultNull()"); |
603 shouldBeEqualToString("converter.testByteString", ""); | 599 shouldBeEqualToString("converter.testByteString", ""); |
604 shouldBeNull("converter.testByteStringTreatReturnedNullStringAsNullAttribute"); | |
605 shouldBeUndefined("converter.testByteStringTreatReturnedNullStringAsUndefinedAtt
ribute"); | |
606 shouldBeNull("converter.getTestByteStringTreatReturnedNullStringAsNullMethod()")
; | |
607 shouldBeUndefined("converter.getTestByteStringTreatReturnedNullStringAsUndefined
Method()"); | |
608 | 600 |
609 evalAndLog("converter.testUSVString = '!@#123ABCabc\\x00\\x80\\xFF\\r\\n\\t'"); | 601 evalAndLog("converter.testUSVString = '!@#123ABCabc\\x00\\x80\\xFF\\r\\n\\t'"); |
610 shouldBeEqualToString("converter.testUSVString", "!@#123ABCabc\x00\x80\xFF\r\n\t
"); | 602 shouldBeEqualToString("converter.testUSVString", "!@#123ABCabc\x00\x80\xFF\r\n\t
"); |
611 evalAndLog("converter.testUSVString = '\\u0100'"); | 603 evalAndLog("converter.testUSVString = '\\u0100'"); |
612 shouldBeEqualToString("converter.testUSVString", "\u0100"); | 604 shouldBeEqualToString("converter.testUSVString", "\u0100"); |
613 shouldThrow("converter.testUSVString = {toString: function() { throw Error(); }}
"); | 605 shouldThrow("converter.testUSVString = {toString: function() { throw Error(); }}
"); |
614 shouldBeEqualToString("converter.testUSVString", "\u0100"); | 606 shouldBeEqualToString("converter.testUSVString", "\u0100"); |
615 [{input: "\uD800", expected: "\uFFFD"}, | 607 [{input: "\uD800", expected: "\uFFFD"}, |
616 {input: "\uDC00", expected: "\uFFFD"}, | 608 {input: "\uDC00", expected: "\uFFFD"}, |
617 {input: "\uD800\u0000", expected: "\uFFFD\u0000"}, | 609 {input: "\uD800\u0000", expected: "\uFFFD\u0000"}, |
618 {input: "\uDC00\u0000", expected: "\uFFFD\u0000"}, | 610 {input: "\uDC00\u0000", expected: "\uFFFD\u0000"}, |
619 {input: "\uDC00\uD800", expected: "\uFFFD\uFFFD"}, | 611 {input: "\uDC00\uD800", expected: "\uFFFD\uFFFD"}, |
620 {input: "\uD834\uDD1E", expected: "\uD834\uDD1E"}, | 612 {input: "\uD834\uDD1E", expected: "\uD834\uDD1E"}, |
621 ].forEach(function(test) { | 613 ].forEach(function(test) { |
622 evalAndLog("converter.testUSVString = " + JSON.stringify(test.input)); | 614 evalAndLog("converter.testUSVString = " + JSON.stringify(test.input)); |
623 shouldBeEqualToString("converter.testUSVString", test.expected); | 615 shouldBeEqualToString("converter.testUSVString", test.expected); |
624 }); | 616 }); |
625 ["true", "123", "null", "undefined"].forEach(function(value) { | 617 ["true", "123", "null", "undefined"].forEach(function(value) { |
626 evalAndLog("converter.testUSVString = " + value); | 618 evalAndLog("converter.testUSVString = " + value); |
627 shouldBeEqualToString("converter.testUSVString", value); | 619 shouldBeEqualToString("converter.testUSVString", value); |
628 shouldBeEqualToString("converter.testUSVStringTreatReturnedNullStringAsNullA
ttribute", value); | |
629 shouldBeEqualToString("converter.testUSVStringTreatReturnedNullStringAsUndef
inedAttribute", value); | |
630 shouldBeEqualToString("converter.getTestUSVStringTreatReturnedNullStringAsNu
llMethod()", value); | |
631 shouldBeEqualToString("converter.getTestUSVStringTreatReturnedNullStringAsUn
definedMethod()", value); | |
632 }); | 620 }); |
633 shouldNotThrow("converter.setTestUSVString('abc')"); | 621 shouldNotThrow("converter.setTestUSVString('abc')"); |
634 shouldNotThrow("converter.setTestUSVStringDefaultNull('abc')"); | 622 shouldNotThrow("converter.setTestUSVStringDefaultNull('abc')"); |
635 shouldNotThrow("converter.setTestUSVString('\\u0100')"); | 623 shouldNotThrow("converter.setTestUSVString('\\u0100')"); |
636 shouldNotThrow("converter.setTestUSVStringDefaultNull('\\u0100')"); | 624 shouldNotThrow("converter.setTestUSVStringDefaultNull('\\u0100')"); |
637 shouldThrow("converter.setTestUSVString()"); | 625 shouldThrow("converter.setTestUSVString()"); |
638 shouldNotThrow("converter.setTestUSVStringDefaultNull()"); | 626 shouldNotThrow("converter.setTestUSVStringDefaultNull()"); |
639 shouldBeEqualToString("converter.testUSVString", ""); | 627 shouldBeEqualToString("converter.testUSVString", ""); |
640 shouldBeNull("converter.testUSVStringTreatReturnedNullStringAsNullAttribute"); | |
641 shouldBeUndefined("converter.testUSVStringTreatReturnedNullStringAsUndefinedAttr
ibute"); | |
642 shouldBeNull("converter.getTestUSVStringTreatReturnedNullStringAsNullMethod()"); | |
643 shouldBeUndefined("converter.getTestUSVStringTreatReturnedNullStringAsUndefinedM
ethod()"); | |
644 | 628 |
645 </script> | 629 </script> |
OLD | NEW |