|
| 1 | +/*--------------------------------------------------------------------------------------------- |
| 2 | + * Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 | + * Licensed under the MIT License. See License.txt in the project root for license information. |
| 4 | + *--------------------------------------------------------------------------------------------*/ |
| 5 | +'use strict'; |
| 6 | + |
| 7 | +import * as assert from 'assert'; |
| 8 | +import {CharCode} from 'vs/base/common/charCode'; |
| 9 | + |
| 10 | +suite('CharCode', () => { |
| 11 | + test('has good values', () => { |
| 12 | + |
| 13 | + function assertValue(actual:CharCode, expected:string): void { |
| 14 | + assert.equal(actual, expected.charCodeAt(0), 'char code ok for <<' + expected + '>>'); |
| 15 | + } |
| 16 | + |
| 17 | + assertValue(CharCode.Tab, '\t'); |
| 18 | + assertValue(CharCode.LineFeed, '\n'); |
| 19 | + assertValue(CharCode.CarriageReturn, '\r'); |
| 20 | + assertValue(CharCode.Space, ' '); |
| 21 | + assertValue(CharCode.ExclamationMark, '!'); |
| 22 | + assertValue(CharCode.DoubleQuote, '"'); |
| 23 | + assertValue(CharCode.Hash, '#'); |
| 24 | + assertValue(CharCode.DollarSign, '$'); |
| 25 | + assertValue(CharCode.PercentSign, '%'); |
| 26 | + assertValue(CharCode.Ampersand, '&'); |
| 27 | + assertValue(CharCode.SingleQuote, '\''); |
| 28 | + assertValue(CharCode.OpenParen, '('); |
| 29 | + assertValue(CharCode.CloseParen, ')'); |
| 30 | + assertValue(CharCode.Asterisk, '*'); |
| 31 | + assertValue(CharCode.Plus, '+'); |
| 32 | + assertValue(CharCode.Comma, ','); |
| 33 | + assertValue(CharCode.Dash, '-'); |
| 34 | + assertValue(CharCode.Period, '.'); |
| 35 | + assertValue(CharCode.Slash, '/'); |
| 36 | + |
| 37 | + assertValue(CharCode.Digit0, '0'); |
| 38 | + assertValue(CharCode.Digit1, '1'); |
| 39 | + assertValue(CharCode.Digit2, '2'); |
| 40 | + assertValue(CharCode.Digit3, '3'); |
| 41 | + assertValue(CharCode.Digit4, '4'); |
| 42 | + assertValue(CharCode.Digit5, '5'); |
| 43 | + assertValue(CharCode.Digit6, '6'); |
| 44 | + assertValue(CharCode.Digit7, '7'); |
| 45 | + assertValue(CharCode.Digit8, '8'); |
| 46 | + assertValue(CharCode.Digit9, '9'); |
| 47 | + |
| 48 | + assertValue(CharCode.Colon, ':'); |
| 49 | + assertValue(CharCode.Semicolon, ';'); |
| 50 | + assertValue(CharCode.LessThan, '<'); |
| 51 | + assertValue(CharCode.Equals, '='); |
| 52 | + assertValue(CharCode.GreaterThan, '>'); |
| 53 | + assertValue(CharCode.QuestionMark, '?'); |
| 54 | + assertValue(CharCode.AtSign, '@'); |
| 55 | + |
| 56 | + assertValue(CharCode.A, 'A'); |
| 57 | + assertValue(CharCode.B, 'B'); |
| 58 | + assertValue(CharCode.C, 'C'); |
| 59 | + assertValue(CharCode.D, 'D'); |
| 60 | + assertValue(CharCode.E, 'E'); |
| 61 | + assertValue(CharCode.F, 'F'); |
| 62 | + assertValue(CharCode.G, 'G'); |
| 63 | + assertValue(CharCode.H, 'H'); |
| 64 | + assertValue(CharCode.I, 'I'); |
| 65 | + assertValue(CharCode.J, 'J'); |
| 66 | + assertValue(CharCode.K, 'K'); |
| 67 | + assertValue(CharCode.L, 'L'); |
| 68 | + assertValue(CharCode.M, 'M'); |
| 69 | + assertValue(CharCode.N, 'N'); |
| 70 | + assertValue(CharCode.O, 'O'); |
| 71 | + assertValue(CharCode.P, 'P'); |
| 72 | + assertValue(CharCode.Q, 'Q'); |
| 73 | + assertValue(CharCode.R, 'R'); |
| 74 | + assertValue(CharCode.S, 'S'); |
| 75 | + assertValue(CharCode.T, 'T'); |
| 76 | + assertValue(CharCode.U, 'U'); |
| 77 | + assertValue(CharCode.V, 'V'); |
| 78 | + assertValue(CharCode.W, 'W'); |
| 79 | + assertValue(CharCode.X, 'X'); |
| 80 | + assertValue(CharCode.Y, 'Y'); |
| 81 | + assertValue(CharCode.Z, 'Z'); |
| 82 | + |
| 83 | + assertValue(CharCode.OpenSquareBracket, '['); |
| 84 | + assertValue(CharCode.Backslash, '\\'); |
| 85 | + assertValue(CharCode.CloseSquareBracket, ']'); |
| 86 | + assertValue(CharCode.Caret, '^'); |
| 87 | + assertValue(CharCode.Underline, '_'); |
| 88 | + assertValue(CharCode.BackTick, '`'); |
| 89 | + |
| 90 | + assertValue(CharCode.a, 'a'); |
| 91 | + assertValue(CharCode.b, 'b'); |
| 92 | + assertValue(CharCode.c, 'c'); |
| 93 | + assertValue(CharCode.d, 'd'); |
| 94 | + assertValue(CharCode.e, 'e'); |
| 95 | + assertValue(CharCode.f, 'f'); |
| 96 | + assertValue(CharCode.g, 'g'); |
| 97 | + assertValue(CharCode.h, 'h'); |
| 98 | + assertValue(CharCode.i, 'i'); |
| 99 | + assertValue(CharCode.j, 'j'); |
| 100 | + assertValue(CharCode.k, 'k'); |
| 101 | + assertValue(CharCode.l, 'l'); |
| 102 | + assertValue(CharCode.m, 'm'); |
| 103 | + assertValue(CharCode.n, 'n'); |
| 104 | + assertValue(CharCode.o, 'o'); |
| 105 | + assertValue(CharCode.p, 'p'); |
| 106 | + assertValue(CharCode.q, 'q'); |
| 107 | + assertValue(CharCode.r, 'r'); |
| 108 | + assertValue(CharCode.s, 's'); |
| 109 | + assertValue(CharCode.t, 't'); |
| 110 | + assertValue(CharCode.u, 'u'); |
| 111 | + assertValue(CharCode.v, 'v'); |
| 112 | + assertValue(CharCode.w, 'w'); |
| 113 | + assertValue(CharCode.x, 'x'); |
| 114 | + assertValue(CharCode.y, 'y'); |
| 115 | + assertValue(CharCode.z, 'z'); |
| 116 | + |
| 117 | + assertValue(CharCode.OpenCurlyBrace, '{'); |
| 118 | + assertValue(CharCode.Pipe, '|'); |
| 119 | + assertValue(CharCode.CloseCurlyBrace, '}'); |
| 120 | + assertValue(CharCode.Tilde, '~'); |
| 121 | + }); |
| 122 | +}); |
0 commit comments