提交 6bec67ea 编写于 作者: H Heejae Chang

fix test break I introduced.

I added encoding check in code that are shared by multiple tests.

this change make encoding check to be explicitly requested
上级 cb6761e4
......@@ -79,7 +79,6 @@ private void TestTemporaryStorage(ITemporaryStorageService temporaryStorageServi
Assert.NotSame(text, text2);
Assert.Equal(text.ToString(), text2.ToString());
Assert.Equal(text.Encoding, text2.Encoding);
temporaryStorage.Dispose();
}
......@@ -334,15 +333,33 @@ public void TestTemporaryStorageTextEncoding()
// test normal string
var text = SourceText.From(new string(' ', 4096) + "public class A {}", Encoding.ASCII);
TestTemporaryStorage(service, text);
TestTemporaryStorageWithEncoding(service, text);
// test empty string
text = SourceText.From(string.Empty);
TestTemporaryStorage(service, text);
TestTemporaryStorageWithEncoding(service, text);
// test large string
text = SourceText.From(new string(' ', 1024 * 1024) + "public class A {}");
TestTemporaryStorage(service, text);
TestTemporaryStorageWithEncoding(service, text);
}
private void TestTemporaryStorageWithEncoding(ITemporaryStorageService temporaryStorageService, SourceText text)
{
// create a temporary storage location
var temporaryStorage = temporaryStorageService.CreateTemporaryTextStorage(System.Threading.CancellationToken.None);
// write text into it
temporaryStorage.WriteTextAsync(text).Wait();
// read text back from it
var text2 = temporaryStorage.ReadTextAsync().Result;
Assert.NotSame(text, text2);
Assert.Equal(text.ToString(), text2.ToString());
Assert.Equal(text.Encoding, text2.Encoding);
temporaryStorage.Dispose();
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册