Permalink
Browse files

Fix linting

  • Loading branch information...
sindresorhus committed Feb 14, 2018
1 parent 576d8d2 commit 12d1276b36cc026ecea1bdfe1771198b242f7b1d
Showing with 4 additions and 3 deletions.
  1. +1 −0 templates.js
  2. +3 −3 test/template-literal.js
@@ -1,3 +1,4 @@
/* eslint-disable unicorn/no-unsafe-regex */
'use strict';
const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
@@ -126,14 +126,14 @@ test('correctly parse escape in parameters (bug #177 comment 318622809)', t => {
test('correctly parses unicode/hex escapes', t => {
const ctx = m.constructor({level: 0});
t.is(ctx`\u0078ylophones are fo\x78y! {magenta.inverse \u0078ylophones are fo\x78y!}`,
t.is(ctx`\u0078ylophones are fo\u0078y! {magenta.inverse \u0078ylophones are fo\u0078y!}`,
'xylophones are foxy! xylophones are foxy!');
});
test('correctly parses string arguments', t => {
const ctx = m.constructor({level: 3});
t.is(ctx`{keyword('black').bold can haz cheezburger}`, '\u001B[38;2;0;0;0m\u001B[1mcan haz cheezburger\u001B[22m\u001B[39m');
t.is(ctx`{keyword('blac\x6B').bold can haz cheezburger}`, '\u001B[38;2;0;0;0m\u001B[1mcan haz cheezburger\u001B[22m\u001B[39m');
t.is(ctx`{keyword('blac\u006B').bold can haz cheezburger}`, '\u001B[38;2;0;0;0m\u001B[1mcan haz cheezburger\u001B[22m\u001B[39m');
t.is(ctx`{keyword('blac\u006B').bold can haz cheezburger}`, '\u001B[38;2;0;0;0m\u001B[1mcan haz cheezburger\u001B[22m\u001B[39m');
});
@@ -159,7 +159,7 @@ test('throws if an extra unescaped } is found', t => {
test('should not parse upper-case escapes', t => {
const ctx = m.constructor({level: 0});
t.is(ctx`\N\n\T\t\X07\x07\U000A\u000A\U000a\u000a`, 'N\nT\tX07\x07U000A\u000AU000a\u000A');
t.is(ctx`\N\n\T\t\X07\u0007\U000A\u000A\U000a\u000a`, 'N\nT\tX07\u0007U000A\u000AU000a\u000A');
});
test('should properly handle undefined template interpolated values', t => {

0 comments on commit 12d1276

Please sign in to comment.