Add tests for strikethrough
This commit is contained in:
Родитель
4f1272a1fd
Коммит
32f4909502
|
@ -45,7 +45,7 @@ export declare const enum StandardTokenType {
|
|||
Other = 0,
|
||||
Comment = 1,
|
||||
String = 2,
|
||||
RegEx = 4
|
||||
RegEx = 3
|
||||
}
|
||||
export interface IGrammarConfiguration {
|
||||
embeddedLanguages?: IEmbeddedLanguagesMap;
|
||||
|
@ -137,23 +137,23 @@ export interface ITokenizeLineResult {
|
|||
* 1098 7654 3210 9876 5432 1098 7654 3210
|
||||
* - -------------------------------------------
|
||||
* xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx
|
||||
* bbbb bbbb bfff ffff ffFF FTTT LLLL LLLL
|
||||
* bbbb bbbb bfff ffff ffFF FFTT LLLL LLLL
|
||||
* - -------------------------------------------
|
||||
* - L = LanguageId (8 bits)
|
||||
* - T = StandardTokenType (3 bits)
|
||||
* - F = FontStyle (3 bits)
|
||||
* - T = StandardTokenType (2 bits)
|
||||
* - F = FontStyle (4 bits)
|
||||
* - f = foreground color (9 bits)
|
||||
* - b = background color (9 bits)
|
||||
*/
|
||||
export declare const enum MetadataConsts {
|
||||
LANGUAGEID_MASK = 255,
|
||||
TOKEN_TYPE_MASK = 1792,
|
||||
FONT_STYLE_MASK = 14336,
|
||||
TOKEN_TYPE_MASK = 768,
|
||||
FONT_STYLE_MASK = 15360,
|
||||
FOREGROUND_MASK = 8372224,
|
||||
BACKGROUND_MASK = 4286578688,
|
||||
LANGUAGEID_OFFSET = 0,
|
||||
TOKEN_TYPE_OFFSET = 8,
|
||||
FONT_STYLE_OFFSET = 11,
|
||||
FONT_STYLE_OFFSET = 10,
|
||||
FOREGROUND_OFFSET = 14,
|
||||
BACKGROUND_OFFSET = 23
|
||||
}
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -60,6 +60,15 @@ tape('StackElementMetadata can overwrite font style', (t: tape.Test) => {
|
|||
t.end();
|
||||
});
|
||||
|
||||
tape('StackElementMetadata can overwrite font style with strikethrough', (t: tape.Test) => {
|
||||
let value = StackElementMetadata.set(0, 1, TemporaryStandardTokenType.RegEx, FontStyle.Strikethrough, 101, 102);
|
||||
assertEquals(t, value, 1, StandardTokenType.RegEx, FontStyle.Strikethrough, 101, 102);
|
||||
|
||||
value = StackElementMetadata.set(value, 0, TemporaryStandardTokenType.Other, FontStyle.None, 0, 0);
|
||||
assertEquals(t, value, 1, StandardTokenType.RegEx, FontStyle.None, 101, 102);
|
||||
t.end();
|
||||
});
|
||||
|
||||
tape('StackElementMetadata can overwrite foreground', (t: tape.Test) => {
|
||||
let value = StackElementMetadata.set(0, 1, TemporaryStandardTokenType.RegEx, FontStyle.Underline | FontStyle.Bold, 101, 102);
|
||||
assertEquals(t, value, 1, StandardTokenType.RegEx, FontStyle.Underline | FontStyle.Bold, 101, 102);
|
||||
|
|
|
@ -369,6 +369,7 @@ tape('Theme parsing can parse', (t: tape.Test) => {
|
|||
{ scope: 'constant.numeric', settings: { foreground: '#00ff00' } },
|
||||
{ scope: 'constant.numeric.hex', settings: { fontStyle: 'bold' } },
|
||||
{ scope: 'constant.numeric.oct', settings: { fontStyle: 'bold italic underline' } },
|
||||
{ scope: 'constant.numeric.bin', settings: { fontStyle: 'bold strikethrough' } },
|
||||
{ scope: 'constant.numeric.dec', settings: { fontStyle: '', foreground: '#0000ff' } },
|
||||
{ scope: 'foo', settings: { fontStyle: '', foreground: '#CFA' } },
|
||||
]
|
||||
|
@ -385,8 +386,9 @@ tape('Theme parsing can parse', (t: tape.Test) => {
|
|||
new ParsedThemeRule('constant.numeric', null, 5, FontStyle.NotSet, '#00ff00', null),
|
||||
new ParsedThemeRule('constant.numeric.hex', null, 6, FontStyle.Bold, null, null),
|
||||
new ParsedThemeRule('constant.numeric.oct', null, 7, FontStyle.Bold | FontStyle.Italic | FontStyle.Underline, null, null),
|
||||
new ParsedThemeRule('constant.numeric.dec', null, 8, FontStyle.None, '#0000ff', null),
|
||||
new ParsedThemeRule('foo', null, 9, FontStyle.None, '#CFA', null),
|
||||
new ParsedThemeRule('constant.numeric.bin', null, 8, FontStyle.Bold | FontStyle.Strikethrough, null, null),
|
||||
new ParsedThemeRule('constant.numeric.dec', null, 9, FontStyle.None, '#0000ff', null),
|
||||
new ParsedThemeRule('foo', null, 10, FontStyle.None, '#CFA', null),
|
||||
];
|
||||
|
||||
t.deepEqual(actual, expected);
|
||||
|
|
Загрузка…
Ссылка в новой задаче