diff options
Diffstat (limited to 'test/suite/intl402/ch09')
-rw-r--r-- | test/suite/intl402/ch09/9.1/9.1.1_1.js | 23 | ||||
-rw-r--r-- | test/suite/intl402/ch09/9.1/9.1.1_2_1.js | 23 | ||||
-rw-r--r-- | test/suite/intl402/ch09/9.1/9.1.1_2_2.js | 23 | ||||
-rw-r--r-- | test/suite/intl402/ch09/9.1/9.1.1_2_3.js | 23 | ||||
-rw-r--r-- | test/suite/intl402/ch09/9.1/9.1.1_2_4.js | 30 | ||||
-rw-r--r-- | test/suite/intl402/ch09/9.1/9.1.1_2_5.js | 28 | ||||
-rw-r--r-- | test/suite/intl402/ch09/9.1/9.1.2.js | 30 | ||||
-rw-r--r-- | test/suite/intl402/ch09/9.1/9.1.3.js | 30 |
8 files changed, 210 insertions, 0 deletions
diff --git a/test/suite/intl402/ch09/9.1/9.1.1_1.js b/test/suite/intl402/ch09/9.1/9.1.1_1.js new file mode 100644 index 000000000..281e6f062 --- /dev/null +++ b/test/suite/intl402/ch09/9.1/9.1.1_1.js @@ -0,0 +1,23 @@ +// Copyright 2012 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @path intl402/ch09/9.1/9.1.1_1.js + * @description Tests initialization of LocaleList object with no parameters. + */ + +function testcase() { + "use strict"; + + var passed = false; + + var list = new Intl.LocaleList(); + if (list.length !== 1) { + $ERROR('LocaleList constructed with no arguments should have 1 element.'); + } + + passed = true; + + return passed; +} +runTestCase(testcase);
\ No newline at end of file diff --git a/test/suite/intl402/ch09/9.1/9.1.1_2_1.js b/test/suite/intl402/ch09/9.1/9.1.1_2_1.js new file mode 100644 index 000000000..f96aa7735 --- /dev/null +++ b/test/suite/intl402/ch09/9.1/9.1.1_2_1.js @@ -0,0 +1,23 @@ +// Copyright 2012 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @path intl402/ch09/9.1/9.1.1_2_1.js + * @description Tests initialization of LocaleList object with an empty list. + */ + +function testcase() { + "use strict"; + + var passed = false; + + var list = new Intl.LocaleList([]); + if (list.length !== 0) { + $ERROR('LocaleList constructed with empty list should have 0 elements.'); + } + + passed = true; + + return passed; +} +runTestCase(testcase);
\ No newline at end of file diff --git a/test/suite/intl402/ch09/9.1/9.1.1_2_2.js b/test/suite/intl402/ch09/9.1/9.1.1_2_2.js new file mode 100644 index 000000000..c5d6655c8 --- /dev/null +++ b/test/suite/intl402/ch09/9.1/9.1.1_2_2.js @@ -0,0 +1,23 @@ +// Copyright 2012 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @path intl402/ch09/9.1/9.1.1_2_2.js + * @description Tests initialization of LocaleList object with duplicate language IDs. + */ + +function testcase() { + "use strict"; + + var passed = false; + + var list = new Intl.LocaleList(['sr-rs', 'sr-rs']); + if (list.length !== 1) { + $ERROR('Duplicates should be removed from the list.'); + } + + passed = true; + + return passed; +} +runTestCase(testcase);
\ No newline at end of file diff --git a/test/suite/intl402/ch09/9.1/9.1.1_2_3.js b/test/suite/intl402/ch09/9.1/9.1.1_2_3.js new file mode 100644 index 000000000..6932ebb73 --- /dev/null +++ b/test/suite/intl402/ch09/9.1/9.1.1_2_3.js @@ -0,0 +1,23 @@ +// Copyright 2012 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @path intl402/ch09/9.1/9.1.1_2_3.js + * @description Tests that language ID gets canonicalized in LocaleList. + */ + +function testcase() { + "use strict"; + + var passed = false; + + var list = new Intl.LocaleList(['SR-CYRL-rS']); + if (list[0] !== 'sr-Cyrl-RS') { + $ERROR('Locale ' + list[0] + ' was not properly canonicalized.'); + } + + passed = true; + + return passed; +} +runTestCase(testcase);
\ No newline at end of file diff --git a/test/suite/intl402/ch09/9.1/9.1.1_2_4.js b/test/suite/intl402/ch09/9.1/9.1.1_2_4.js new file mode 100644 index 000000000..a8d7a870a --- /dev/null +++ b/test/suite/intl402/ch09/9.1/9.1.1_2_4.js @@ -0,0 +1,30 @@ +// Copyright 2012 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @path intl402/ch09/9.1/9.1.1_2_4.js + * @description Tests initialization of LocaleList object with non-string parameters. + */ + +function testcase() { + "use strict"; + + var passed = false; + + var list = undefined; + try { + list = new Intl.LocaleList([5]); + } catch(e) { + if (!(e instanceof TypeError)) { + $ERROR('LocaleList should throw TypeError exception for non-string argument.'); + } + } + if (list !== undefined) { + $ERROR('LocaleList should throw TypeError exception for non-string argument.'); + } + + passed = true; + + return passed; +} +runTestCase(testcase);
\ No newline at end of file diff --git a/test/suite/intl402/ch09/9.1/9.1.1_2_5.js b/test/suite/intl402/ch09/9.1/9.1.1_2_5.js new file mode 100644 index 000000000..b09a57983 --- /dev/null +++ b/test/suite/intl402/ch09/9.1/9.1.1_2_5.js @@ -0,0 +1,28 @@ +// Copyright 2012 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @path intl402/ch09/9.1/9.1.1_2_5.js + * @description Tests initialization of LocaleList object with invalid locale IDs. + */ + +function testcase() { + "use strict"; + + var passed = false; + + var list = undefined; + try { + list = new Intl.LocaleList(['']); + } catch(e) { + // Throws invalid language tag exception. + } + if (list !== undefined) { + $ERROR('Empty string should be an invalid locale identifier.'); + } + + passed = true; + + return passed; +} +runTestCase(testcase);
\ No newline at end of file diff --git a/test/suite/intl402/ch09/9.1/9.1.2.js b/test/suite/intl402/ch09/9.1/9.1.2.js new file mode 100644 index 000000000..7be1ec312 --- /dev/null +++ b/test/suite/intl402/ch09/9.1/9.1.2.js @@ -0,0 +1,30 @@ +// Copyright 2012 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @path intl402/ch09/9.1/9.1.2.js + * @description Tests Intl.LocaleList as a function. + */ + +function testcase() { + "use strict"; + + var passed = false; + + var list = Intl.LocaleList(); + + if (list.length !== 1) { + $ERROR('LocaleList constructed with no arguments should have 1 element.'); + } + + // Using new Intl.LocaleList and calling Intl.LocaleList should produce the + // same result. + if (new Intl.LocaleList()[0] !== list[0]) { + $ERROR('Intl.LocaleList()[0] should be equal to new Intl.LocaleList()[0]'); + } + + passed = true; + + return passed; +} +runTestCase(testcase);
\ No newline at end of file diff --git a/test/suite/intl402/ch09/9.1/9.1.3.js b/test/suite/intl402/ch09/9.1/9.1.3.js new file mode 100644 index 000000000..d1bb7e081 --- /dev/null +++ b/test/suite/intl402/ch09/9.1/9.1.3.js @@ -0,0 +1,30 @@ +// Copyright 2012 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @path intl402/ch09/9.1/9.1.3.js + * @description Tests Intl.LocaleList as a constructor. + */ + +function testcase() { + "use strict"; + + var passed = false; + + var list = new Intl.LocaleList(); + + if (list.length !== 1) { + $ERROR('LocaleList constructed with no arguments should have 1 element.'); + } + + // Using new Intl.LocaleList and calling Intl.LocaleList should produce the + // same result. + if (Intl.LocaleList()[0] !== list[0]) { + $ERROR('Intl.LocaleList()[0] should be equal to new Intl.LocaleList()[0]'); + } + + passed = true; + + return passed; +} +runTestCase(testcase);
\ No newline at end of file |