<commit_before>﻿// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System.Diagnostics.CodeAnalysis;
using FluentAssertions;
using Microsoft.Languages.Core.Classification;
using Microsoft.Languages.Core.Test.Tokens;
using Microsoft.Markdown.Editor.Tokens;
using Microsoft.UnitTests.Core.XUnit;
using Xunit;

namespace Microsoft.Markdown.Editor.Test.Tokens {
    [ExcludeFromCodeCoverage]
    public class TokenizeMdBlockTest : TokenizeTestBase<MarkdownToken, MarkdownTokenType> {
        [CompositeTest]
        [InlineData(
@"```
block

block
```
", 24)]
        [InlineData(
@"```
block```
 ```
block
```
", 31)]
        [Category.Md.Tokenizer]
        public void CodeBlock01(string text, int length) {
            var tokens = Tokenize(text, new MdTokenizer());
            tokens.Should().HaveCount(1);
            tokens[0].Should().HaveType(MarkdownTokenType.Monospace);
            tokens[0].Length.Should().Be(length);
        }

        [CompositeTest]
        [InlineData(
@"```{r}
#comment
```
")]
        [Category.Md.Tokenizer]
        public void CodeBlock02(string text) {
            var tokens = Tokenize(text, new MdTokenizer());
            tokens.Should().HaveCount(1);
            tokens[0].Should().HaveType(MarkdownTokenType.Code);
            tokens[0].Length.Should().Be(21);
        }

        [CompositeTest]
        [InlineData(@"```block```")]
        [InlineData(@"```block")]
        [InlineData(@"```block` ```")]
        [Category.Md.Tokenizer]
        public void TokenizeMd_BlockEmpty(string text) {
            var tokens = Tokenize(text, new MdTokenizer());
            tokens.Should().BeEmpty();
        }

        [CompositeTest]
        [Category.Md.Tokenizer]
        [InlineData(@"`r x <- 1`")]
        [InlineData(@"`rtoken`")]
        public void CodeBlock03(string content) {
            var tokens = Tokenize(@"`r x <- 1`", new MdTokenizer());
            tokens.Should().HaveCount(1);
            tokens[0].Should().HaveType(MarkdownTokenType.Code);
        }
    }
}<commit_msg>Adjust test name<commit_after>﻿// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System.Diagnostics.CodeAnalysis;
using FluentAssertions;
using Microsoft.Languages.Core.Classification;
using Microsoft.Languages.Core.Test.Tokens;
using Microsoft.Markdown.Editor.Tokens;
using Microsoft.UnitTests.Core.XUnit;
using Xunit;

namespace Microsoft.Markdown.Editor.Test.Tokens {
    [ExcludeFromCodeCoverage]
    public class TokenizeMdBlockTest : TokenizeTestBase<MarkdownToken, MarkdownTokenType> {
        [CompositeTest]
        [InlineData(
@"```
block

block
```
", 24)]
        [InlineData(
@"```
block```
 ```
block
```
", 31)]
        [Category.Md.Tokenizer]
        public void CodeBlock01(string text, int length) {
            var tokens = Tokenize(text, new MdTokenizer());
            tokens.Should().HaveCount(1);
            tokens[0].Should().HaveType(MarkdownTokenType.Monospace);
            tokens[0].Length.Should().Be(length);
        }

        [CompositeTest]
        [InlineData(
@"```{r}
#comment
```
")]
        [Category.Md.Tokenizer]
        public void CodeBlock02(string text) {
            var tokens = Tokenize(text, new MdTokenizer());
            tokens.Should().HaveCount(1);
            tokens[0].Should().HaveType(MarkdownTokenType.Code);
            tokens[0].Length.Should().Be(21);
        }

        [CompositeTest]
        [Category.Md.Tokenizer]
        [InlineData(@"`r x <- 1`")]
        [InlineData(@"`rtoken`")]
        public void CodeBlock03(string content) {
            var tokens = Tokenize(@"`r x <- 1`", new MdTokenizer());
            tokens.Should().HaveCount(1);
            tokens[0].Should().HaveType(MarkdownTokenType.Code);
        }

        [CompositeTest]
        [InlineData(@"```block```")]
        [InlineData(@"```block")]
        [InlineData(@"```block` ```")]
        [Category.Md.Tokenizer]
        public void CodeBlock04(string text) {
            var tokens = Tokenize(text, new MdTokenizer());
            tokens.Should().HaveCount(1);
        }
    }
}
{'fraction_non_alphanumeric': 0.14580403187998126, 'fraction_numerical': 0.011017346460384434, 'mean_word_length': 2.7007805724197746, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6883907', 'n_tokens_mistral': 1282, 'n_tokens_neox': 1243, 'n_words': 240}