12345678910111213141516171819202122 | test "file embeds"
>> bytes := _embed_ ./embed_files/hello.txt
assert bytes.length == 14
text : Text = _embed_ ./embed_files/hello.txt
assert text == "Hello, embeds!"
dotfile : Text = _embed_ ./embed_files/.hidden
assert dotfile == "hidden"
test "directory embeds"
files := _embed_ ./embed_files
assert files.length == 3
assert files.keys == [(./hello.txt), (./inner/nested.txt), (./unicode.txt)]
assert files[(./inner/nested.txt)]! == "Nested file".utf8()
test "directory embeds as text"
texts : {Path:Text} = _embed_ ./embed_files
assert texts[(./hello.txt)]! == "Hello, embeds!"
assert texts[(./unicode.txt)]! == "café ☕"
test "directory embeds as C strings"
strings : {Path:CString} = _embed_ ./embed_files
assert Text.from_c_string(strings[(./hello.txt)]!)! == "Hello, embeds!"
|