Ejemplo n.º 1
0
        public async Task TestCharsetWrong_CharsetFixed(string codeValue, string expectedValue)
        {
            var codeEncoding     = CharsetFormatter.GetCharset(codeValue);
            var expectedEncoding = CharsetFormatter.GetCharset(expectedValue);

            var testCode = "class C { }";

            var editorConfig = new Dictionary <string, string>()
            {
                ["charset"] = expectedValue,
            };

            var formattedText = await TestAsync(testCode, testCode, editorConfig, codeEncoding);

            Assert.Equal(expectedEncoding, formattedText.Encoding);
        }
Ejemplo n.º 2
0
        public async Task TestCharsetWrong_CharsetFixed(string codeValue, string expectedValue)
        {
            var codeEncoding     = CharsetFormatter.GetCharset(codeValue);
            var expectedEncoding = CharsetFormatter.GetCharset(expectedValue);

            // Use unicode to ensure that "latin1" and "utf8" don't look equivalent.
            var testCode = "class 🤵 { }";

            var editorConfig = new Dictionary <string, string>()
            {
                ["charset"] = expectedValue,
            };

            var formattedText = await TestAsync(testCode, testCode, editorConfig, codeEncoding);

            Assert.Equal(expectedEncoding, formattedText.Encoding);
        }