OLD | NEW |
---|---|
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 try { parseInt('123', throwingRadix); } catch (e) {} | 107 try { parseInt('123', throwingRadix); } catch (e) {} |
108 assertEquals(state, "throwingRadix"); | 108 assertEquals(state, "throwingRadix"); |
109 | 109 |
110 state = null; | 110 state = null; |
111 try { parseInt(throwingString, 10); } catch (e) {} | 111 try { parseInt(throwingString, 10); } catch (e) {} |
112 assertEquals(state, "throwingString"); | 112 assertEquals(state, "throwingString"); |
113 | 113 |
114 state = null; | 114 state = null; |
115 try { parseInt(throwingString, throwingRadix); } catch (e) {} | 115 try { parseInt(throwingString, throwingRadix); } catch (e) {} |
116 assertEquals(state, "throwingString"); | 116 assertEquals(state, "throwingString"); |
117 | |
118 // And finally, check that the Harmony additions to the Number | |
119 // constructor is available: | |
120 assertTrue("parseInt" in Number); | |
121 assertTrue("parseFloat" in Number); | |
122 assertEquals(Number.parseFloat('0.1'), parseFloat('0.1')); | |
Michael Starzinger
2014/01/07 16:08:00
The spec requires "Number.parseFloat" and "parseFl
sof
2014/01/07 21:36:29
Added
| |
123 assertEquals(Number.parseInt('0xea'), parseInt('0xEA')); | |
OLD | NEW |