Skip to content

Commit 53e3c1b

Browse files
committed
Added test for UTF16 in Yaml
1 parent e8d7113 commit 53e3c1b

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

YamlDotNet.Test/Core/ScannerTests.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file is part of YamlDotNet - A .NET library for YAML.
1+
// This file is part of YamlDotNet - A .NET library for YAML.
22
// Copyright (c) Antoine Aubry and contributors
33
//
44
// Permission is hereby granted, free of charge, to any person obtaining a copy of
@@ -544,6 +544,20 @@ public void Utf16StringsAsUtf8SurrogatesWorkCorrectly()
544544
StreamEnd);
545545
}
546546

547+
[Fact]
548+
public void Utf16CharactersAreReadCorrectly()
549+
{
550+
AssertSequenceOfTokensFrom(Yaml.ScannerForText("Test: \"\uD83D\uDC4D\""),
551+
StreamStart,
552+
BlockMappingStart,
553+
Key,
554+
PlainScalar("Test"),
555+
Value,
556+
DoubleQuotedScalar("\uD83D\uDC4D"), // guaranteed thumbs up emoticon that will work in Windows Terminal since it pukes on displaying it.
557+
BlockEnd,
558+
StreamEnd);
559+
}
560+
547561
private void AssertPartialSequenceOfTokensFrom(Scanner scanner, params Token[] tokens)
548562
{
549563
var tokenNumber = 1;

0 commit comments

Comments
 (0)