Skip to content

Commit

Permalink
Tests for Base.cwstring
Browse files Browse the repository at this point in the history
  • Loading branch information
rileysheridan committed Oct 11, 2024
1 parent 22cde34 commit 0c5d494
Show file tree
Hide file tree
Showing 30 changed files with 15 additions and 0 deletions.
Empty file modified contrib/asan/build.sh
100755 → 100644
Empty file.
Empty file modified contrib/asan/check.jl
100755 → 100644
Empty file.
Empty file modified contrib/bpftrace/gc_all.bt
100755 → 100644
Empty file.
Empty file modified contrib/bpftrace/gc_simple.bt
100755 → 100644
Empty file.
Empty file modified contrib/bpftrace/gc_stop_the_world_latency.bt
100755 → 100644
Empty file.
Empty file modified contrib/bpftrace/rt_all.bt
100755 → 100644
Empty file.
Empty file modified contrib/check-whitespace.jl
100755 → 100644
Empty file.
Empty file modified contrib/commit-name.sh
100755 → 100644
Empty file.
Empty file modified contrib/delete-all-rpaths.sh
100755 → 100644
Empty file.
Empty file modified contrib/download_cmake.sh
100755 → 100644
Empty file.
Empty file modified contrib/excise_stdlib.sh
100755 → 100644
Empty file.
Empty file modified contrib/fixup-libgfortran.sh
100755 → 100644
Empty file.
Empty file modified contrib/fixup-libstdc++.sh
100755 → 100644
Empty file.
Empty file modified contrib/fixup-rpath.sh
100755 → 100644
Empty file.
Empty file modified contrib/install.sh
100755 → 100644
Empty file.
Empty file modified contrib/julia-config.jl
100755 → 100644
Empty file.
Empty file modified contrib/mac/app/notarize_check.sh
100755 → 100644
Empty file.
Empty file modified contrib/mac/app/renotarize_dmg.sh
100755 → 100644
Empty file.
Empty file modified contrib/new-stdlib.sh
100755 → 100644
Empty file.
Empty file modified contrib/normalize_triplet.py
100755 → 100644
Empty file.
Empty file modified contrib/prepare_release.sh
100755 → 100644
Empty file.
Empty file modified contrib/relative_path.py
100755 → 100644
Empty file.
Empty file modified contrib/tsan/build.sh
100755 → 100644
Empty file.
Empty file modified contrib/windows/icon-readme.md
100755 → 100644
Empty file.
Empty file modified contrib/windows/julia-banner.bmp
100755 → 100644
Empty file.
Empty file modified contrib/windows/julia.ico
100755 → 100644
Empty file.
Empty file modified deps/tools/jlchecksum
100755 → 100644
Empty file.
Empty file modified deps/tools/jldownload
100755 → 100644
Empty file.
Empty file modified src/flisp/bootstrap.sh
100755 → 100644
Empty file.
15 changes: 15 additions & 0 deletions test/strings/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1409,3 +1409,18 @@ end
@test transcode(String, transcode(UInt8, transcode(UInt16, str))) == str
end
end

@testset "cwstring" begin
# empty string
str_0 = ""
# string with embedded NUL character
str_1 = "Au\000B"
# string with terminating NUL character
str_2 = "Wordu\000"
# "Regular" string with UTF-8 characters of differing byte counts
str_3 = "aܣ𒀀"
@test Base.cwstring(str_0) = UInt16[0x0000]
@test_throws ArgumentError Base.cwstring(str_1)
@test Base.cwstring(str_2) == UInt16[0x0057, 0x006f, 0x0072, 0x0064, 0x0000]
@test Base.cwstring(str_3) == UInt16[0x0061, 0x0723, 0xd808, 0xdc00, 0x0000]
end

0 comments on commit 0c5d494

Please sign in to comment.