@ryusei/light
Version:
<div align="center"> <a href="https://light.ryuseijs.com"> <img alt="RyuseiLight" src="https://light.ryuseijs.com/images/svg/logo.svg" width="70"> </a>
37 lines (29 loc) • 1.26 kB
JavaScript
import { CATEGORY_STRING } from '../../../constants/categories';
describe( 'javascript', () => {
test( 'can tokenize single quote strings.', () => {
expect( `'single quote string'` ).toBeTokenized( 'javascript', [
[ CATEGORY_STRING, `'single quote string'` ],
] );
expect( `'single "quote" string'` ).toBeTokenized( 'javascript', [
[ CATEGORY_STRING, `'single "quote" string'` ],
] );
} );
test( 'can tokenize single quote strings with escaped quotes.', () => {
expect( `'escaped single \\' \\' \\'quote string'` ).toBeTokenized( 'javascript', [
[ CATEGORY_STRING, `'escaped single \\' \\' \\'quote string'` ],
] );
} );
test( 'can tokenize double quote strings.', () => {
expect( `"double quote string"` ).toBeTokenized( 'javascript', [
[ CATEGORY_STRING, `"double quote string"` ],
] );
expect( `"double 'quote' string"` ).toBeTokenized( 'javascript', [
[ CATEGORY_STRING, `"double 'quote' string"` ],
] );
} );
test( 'can tokenize single quote strings with escaped quotes.', () => {
expect( `"escaped double \\" \\" \\"quote string"` ).toBeTokenized( 'javascript', [
[ CATEGORY_STRING, `"escaped double \\" \\" \\"quote string"` ],
] );
} );
} );