hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 3af873e41fe432ee493bed68409654796310c9cf
parent 3ced0bd025bbcbfcc36c8fa6ef1a03a89a83fd83
Author: Drew DeVault <sir@cmpwn.com>
Date:   Fri, 12 Feb 2021 14:37:32 -0500

strings: add utf8 test

Diffstat:
Mstrings/utf8.ha | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/strings/utf8.ha b/strings/utf8.ha @@ -23,3 +23,10 @@ export fn from_utf8(in: []u8) str = { // Converts a string to a UTF-8 slice. export fn to_utf8(in: str) []u8 = *(&in: *[]u8); + +@test fn utf8() void = { + assert(from_utf8([ + 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, + ]) == "hello world"); + assert(from_utf8([]) == ""); +};