From 5e7f17427b75f1ea960397c66c1f48a8d64f418a Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 5 Jun 2021 16:21:22 +0900 Subject: [PATCH] Add inlineCode tests --- test/parser.ts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/test/parser.ts b/test/parser.ts index 14666a3..391af37 100644 --- a/test/parser.ts +++ b/test/parser.ts @@ -1,7 +1,7 @@ import assert from 'assert'; import * as mfm from '../built/index'; import { - TEXT, CENTER, FN, UNI_EMOJI, MENTION, EMOJI_CODE, HASHTAG, N_URL, BOLD, SMALL, ITALIC, STRIKE, QUOTE, MATH_BLOCK, SEARCH, CODE_BLOCK, LINK + TEXT, CENTER, FN, UNI_EMOJI, MENTION, EMOJI_CODE, HASHTAG, N_URL, BOLD, SMALL, ITALIC, STRIKE, QUOTE, MATH_BLOCK, SEARCH, CODE_BLOCK, LINK, INLINE_CODE } from '../built/index'; describe('PlainParser', () => { @@ -506,7 +506,25 @@ describe('FullParser', () => { // strike - // inlineCode + describe('inlineCode', () => { + it('basic', () => { + const input = '`var x = "Strawberry Pasta";`'; + const output = [INLINE_CODE('var x = "Strawberry Pasta";')]; + assert.deepStrictEqual(mfm.parse(input), output); + }); + + it('disallow line break', () => { + const input = '`foo\nbar`'; + const output = [TEXT('`foo\nbar`')]; + assert.deepStrictEqual(mfm.parse(input), output); + }); + + it('disallow ´', () => { + const input = '`foo´bar`'; + const output = [TEXT('`foo´bar`')]; + assert.deepStrictEqual(mfm.parse(input), output); + }); + }); // mathInline