Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: test/intl/overrides/number.js

Issue 18687003: Import intl test suite from v8-i18n project (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/intl/overrides/number.js
diff --git a/src/extensions/i18n/i18n-extension.h b/test/intl/overrides/number.js
similarity index 63%
copy from src/extensions/i18n/i18n-extension.h
copy to test/intl/overrides/number.js
index 050c336a67a21fd6cb32892e14215cac11971111..9a25c14718d3ce83d0c3b09a1f4dee508ebc1caa 100644
--- a/src/extensions/i18n/i18n-extension.h
+++ b/test/intl/overrides/number.js
@@ -26,26 +26,29 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// limitations under the License.
-#ifndef V8_EXTENSIONS_I18N_I18N_EXTENSION_H_
-#define V8_EXTENSIONS_I18N_I18N_EXTENSION_H_
+// Tests Number.prototype.toLocaleString method override.
-#include "v8.h"
+var integer = 123456790;
+var float = 1234567890.123434;
-namespace v8_i18n {
-class Extension : public v8::Extension {
- public:
- Extension();
+// Defaults
+var nf = new Intl.NumberFormat();
+assertEquals(nf.format(integer), integer.toLocaleString());
+assertEquals(nf.format(float), float.toLocaleString());
- virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(
- v8::Handle<v8::String> name);
- static void Register();
+// Specify locale, default options for toLocaleString method.
+var locale = ['sr'];
+nf = new Intl.NumberFormat(locale);
+assertEquals(nf.format(integer), integer.toLocaleString(locale));
+assertEquals(nf.format(float), float.toLocaleString(locale));
- private:
- static Extension* extension_;
-};
-} // namespace v8_i18n
-
-#endif // V8_EXTENSIONS_I18N_I18N_EXTENSION_H_
+// Specify locale and options for toLocaleString method.
+locale = ['ko'];
+var options = {minimumIntegerDigits: 8, useGroupingSeparator: true,
+ minimumFractionalDigits: 1, maximumFractionalDigits: 2};
+nf = new Intl.NumberFormat(locale, options);
+assertEquals(nf.format(integer), integer.toLocaleString(locale, options));
+assertEquals(nf.format(float), float.toLocaleString(locale, options));

Powered by Google App Engine
This is Rietveld 408576698