aboutsummaryrefslogtreecommitdiff
path: root/contexts/data/lib/closure-library/closure/goog/i18n/uchar_test.html
blob: 0646cc71700f3a2715ddbb08872f5fc6c5fff75b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html>
<!--
Copyright 2009 The Closure Library Authors. All Rights Reserved.

Use of this source code is governed by the Apache License, Version 2.0.
See the COPYING file for details.
-->
<!--
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Closure Unit Tests - goog.i18n.uChar</title>
<meta charset=utf-8>

<script src="../base.js"></script>
<script>
  goog.require('goog.i18n.uChar');
  goog.require('goog.testing.jsunit');
</script>
</head>
<body>
<script>
function testToHexString() {
  var result = goog.i18n.uChar.toHexString('\uD869\uDED6');
  assertEquals('U+2A6D6', result);
}

function testPadString() {
  var result = goog.i18n.uChar.padString_('abc', 4, '0');
  assertEquals('0abc', result);
}

function testToCharCode() {
  var result = goog.i18n.uChar.toCharCode('\uD869\uDED6');
  assertEquals(0x2A6D6, result);
}

function testFromCharCode() {
  var result = goog.i18n.uChar.fromCharCode(0x2A6D6);
  assertEquals('\uD869\uDED6', result);
}

function testToName() {
  var result = goog.i18n.uChar.toName(' ');
  assertEquals('Space', result);
}

function testToNameForNumberKey() {
  var result = goog.i18n.uChar.toName('\u2028');
  assertEquals('Line Separator', result);
}

function testToNameForVariationSelector() {
  var result = goog.i18n.uChar.toName('\ufe00');
  assertEquals('Variation Selector - 1', result);
}

function testToNameForVariationSelectorSupp() {
  var result = goog.i18n.uChar.toName('\uDB40\uDD00');
  assertEquals('Variation Selector - 17', result);
}

function testToNameForNull() {
  var result = goog.i18n.uChar.toName('a');
  assertNull(result);
}

</script>
</body>
</html>