| 1 |
// Copyright 2009 The Closure Library Authors. All Rights Reserved. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS-IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
goog.provide('goog.i18n.uCharNamesTest'); |
| 16 |
goog.setTestOnly('goog.i18n.uCharNamesTest'); |
| 17 |
|
| 18 |
goog.require('goog.i18n.uCharNames'); |
| 19 |
goog.require('goog.testing.jsunit'); |
| 20 |
|
| 21 |
function testToName() { |
| 22 |
var result = goog.i18n.uCharNames.toName(' '); |
| 23 |
assertEquals('Space', result); |
| 24 |
} |
| 25 |
|
| 26 |
function testToNameForNumberKey() { |
| 27 |
var result = goog.i18n.uCharNames.toName('\u2028'); |
| 28 |
assertEquals('Line Separator', result); |
| 29 |
} |
| 30 |
|
| 31 |
function testToNameForVariationSelector() { |
| 32 |
var result = goog.i18n.uCharNames.toName('\ufe00'); |
| 33 |
assertEquals('Variation Selector - 1', result); |
| 34 |
} |
| 35 |
|
| 36 |
function testToNameForVariationSelectorSupp() { |
| 37 |
var result = goog.i18n.uCharNames.toName('\uDB40\uDD00'); |
| 38 |
assertEquals('Variation Selector - 17', result); |
| 39 |
} |
| 40 |
|
| 41 |
function testToNameForNull() { |
| 42 |
var result = goog.i18n.uCharNames.toName('a'); |
| 43 |
assertNull(result); |
| 44 |
} |