Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
test262
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pmaksimo
test262
Commits
8ce24bb8
Commit
8ce24bb8
authored
6 years ago
by
Ms2ger
Browse files
Options
Downloads
Patches
Plain Diff
Add a test for Locale#{minimize,maximize}.
parent
92003a3e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/intl402/Locale/likely-subtags.js
+107
-0
107 additions, 0 deletions
test/intl402/Locale/likely-subtags.js
with
107 additions
and
0 deletions
test/intl402/Locale/likely-subtags.js
0 → 100644
+
107
−
0
View file @
8ce24bb8
// Copyright 2018 André Bargull; Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-intl.locale
description: >
Verifies canonicalization, minimization and maximization of specific tags.
info: |
Intl.Locale.prototype.maximize ()
3. Let maximal be the result of the Add Likely Subtags algorithm applied to loc.[[Locale]].
Intl.Locale.prototype.minimize ()
3. Let minimal be the result of the Remove Likely Subtags algorithm applied to loc.[[Locale]].
features: [Intl.Locale]
---*/
const
testDataMaximal
=
{
// Language subtag is present.
"
en
"
:
"
en-Latn-US
"
,
// Language and script subtags are present.
"
en-Latn
"
:
"
en-Latn-US
"
,
"
en-Shaw
"
:
"
en-Shaw-GB
"
,
"
en-Arab
"
:
"
en-Arab-US
"
,
// Language and region subtags are present.
"
en-US
"
:
"
en-Latn-US
"
,
"
en-GB
"
:
"
en-Latn-GB
"
,
"
en-FR
"
:
"
en-Latn-FR
"
,
// Language, script, and region subtags are present.
"
it-Kana-CA
"
:
"
it-Kana-CA
"
,
// Undefined primary language.
"
und
"
:
"
en-Latn-US
"
,
"
und-Thai
"
:
"
th-Thai-TH
"
,
"
und-419
"
:
"
es-Latn-419
"
,
"
und-150
"
:
"
ru-Cyrl-RU
"
,
"
und-AT
"
:
"
de-Latn-AT
"
,
// privateuse only.
"
x-private
"
:
"
x-private
"
,
};
const
testDataMinimal
=
{
// Language subtag is present.
"
en
"
:
"
en
"
,
// Language and script subtags are present.
"
en-Latn
"
:
"
en
"
,
"
ar-Arab
"
:
"
ar
"
,
// Language and region subtags are present.
"
en-US
"
:
"
en
"
,
"
en-GB
"
:
"
en-GB
"
,
// Reverse cases from |testDataMaximal|.
"
en-Latn-US
"
:
"
en
"
,
"
en-Shaw-GB
"
:
"
en-Shaw
"
,
"
en-Arab-US
"
:
"
en-Arab
"
,
"
en-Latn-GB
"
:
"
en-GB
"
,
"
en-Latn-FR
"
:
"
en-FR
"
,
"
it-Kana-CA
"
:
"
it-Kana-CA
"
,
"
th-Thai-TH
"
:
"
th
"
,
"
es-Latn-419
"
:
"
es-419
"
,
"
ru-Cyrl-RU
"
:
"
ru
"
,
"
de-Latn-AT
"
:
"
de-AT
"
,
// privateuse only.
"
x-private
"
:
"
x-private
"
,
};
// Add variants, extensions, and privateuse subtags and ensure they don't
// modify the result of the likely subtags algorithms.
const
extras
=
[
""
,
"
-fonipa
"
,
"
-a-not-assigned
"
,
"
-u-attr
"
,
"
-u-co
"
,
"
-u-co-phonebk
"
,
"
-x-private
"
,
];
for
(
const
[
tag
,
maximal
]
of
Object
.
entries
(
testDataMaximal
))
{
assert
.
sameValue
(
new
Intl
.
Locale
(
maximal
).
maximize
().
toString
(),
maximal
,
`"
${
maximal
}
" should be maximal`
);
for
(
const
extra
of
extras
)
{
const
input
=
tag
+
extra
;
const
output
=
maximal
+
extra
;
assert
.
sameValue
(
new
Intl
.
Locale
(
input
).
maximize
().
toString
(),
output
,
`"
${
input
}
".maximize() should be "
${
output
}
"`
);
}
}
for
(
const
[
tag
,
minimal
]
of
Object
.
entries
(
testDataMinimal
))
{
assert
.
sameValue
(
new
Intl
.
Locale
(
minimal
).
minimize
().
toString
(),
minimal
,
`"
${
minimal
}
" should be minimal`
);
for
(
const
extra
of
extras
)
{
const
input
=
tag
+
extra
;
const
output
=
minimal
+
extra
;
assert
.
sameValue
(
new
Intl
.
Locale
(
input
).
minimize
().
toString
(),
output
,
`"
${
input
}
".minimize() should be "
${
output
}
"`
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment