From db7374bf2a9dfacfd1a885b33e7831efec5599e4 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Tue, 31 Mar 2015 17:12:05 +0200 Subject: [PATCH] Show that escaped unicode characters are encoded incorrectly - references #338 --- .../FSharp.Compiler.Unittests.fsproj | 1 + .../FSharp.Compiler.Unittests/Unicode.fs | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/fsharp/FSharp.Compiler.Unittests/Unicode.fs diff --git a/src/fsharp/FSharp.Compiler.Unittests/FSharp.Compiler.Unittests.fsproj b/src/fsharp/FSharp.Compiler.Unittests/FSharp.Compiler.Unittests.fsproj index 5e468db0c9f6..3aacdc850f46 100644 --- a/src/fsharp/FSharp.Compiler.Unittests/FSharp.Compiler.Unittests.fsproj +++ b/src/fsharp/FSharp.Compiler.Unittests/FSharp.Compiler.Unittests.fsproj @@ -60,6 +60,7 @@ + diff --git a/src/fsharp/FSharp.Compiler.Unittests/Unicode.fs b/src/fsharp/FSharp.Compiler.Unittests/Unicode.fs new file mode 100644 index 000000000000..f6c1338d0a17 --- /dev/null +++ b/src/fsharp/FSharp.Compiler.Unittests/Unicode.fs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace FSharp.Compiler.Unittests + +open System +open System.Text + +open NUnit.Framework + +[] +type Unicodetest() = + + [] + // checks #338 + member this.``Escaped unicode characters are encoded correctly``()= + Assert.AreEqual(54528us,"\uD500".[0] |> uint16) + Assert.AreEqual(55040us,"\uD700".[0] |> uint16) + Assert.AreEqual(55296us,"\uD800".[0] |> uint16) + Assert.AreEqual(55552us,"\uD900".[0] |> uint16) + Assert.AreEqual(57344us,"\uE000".[0] |> uint16) \ No newline at end of file