Skip to content

Commit

Permalink
Added test for UTF16 in Yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwardCooke committed Aug 28, 2023
1 parent e8d7113 commit 53e3c1b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion YamlDotNet.Test/Core/ScannerTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of YamlDotNet - A .NET library for YAML.
// This file is part of YamlDotNet - A .NET library for YAML.
// Copyright (c) Antoine Aubry and contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
Expand Down Expand Up @@ -544,6 +544,20 @@ public void Utf16StringsAsUtf8SurrogatesWorkCorrectly()
StreamEnd);
}

[Fact]
public void Utf16CharactersAreReadCorrectly()
{
AssertSequenceOfTokensFrom(Yaml.ScannerForText("Test: \"\uD83D\uDC4D\""),
StreamStart,
BlockMappingStart,
Key,
PlainScalar("Test"),
Value,
DoubleQuotedScalar("\uD83D\uDC4D"), // guaranteed thumbs up emoticon that will work in Windows Terminal since it pukes on displaying it.
BlockEnd,
StreamEnd);
}

private void AssertPartialSequenceOfTokensFrom(Scanner scanner, params Token[] tokens)
{
var tokenNumber = 1;
Expand Down

0 comments on commit 53e3c1b

Please sign in to comment.