diff options
| author | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-18 15:57:40 +0000 |
|---|---|---|
| committer | Zuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian> | 2026-01-18 15:57:40 +0000 |
| commit | 43c4f78eb3d2af7778bab6e51d77588bec62930d (patch) | |
| tree | f8614e429ef913467420af7d08d104030ec6d434 /tests/features/test_embed.zc | |
| parent | a7eceb21faf04762379f2ce4d23d21bbc8c11929 (diff) | |
Update docs + add '..<' + add typed embed.
Diffstat (limited to 'tests/features/test_embed.zc')
| -rw-r--r-- | tests/features/test_embed.zc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/features/test_embed.zc b/tests/features/test_embed.zc index f6d9468..33acef2 100644 --- a/tests/features/test_embed.zc +++ b/tests/features/test_embed.zc @@ -53,5 +53,31 @@ test "test_embed" { ""; "Analysis successfully completed."; +} + +test "typed_embed" { + // String + var s = embed "tests/features/embed_data.txt" as string; + // "Hello World!\n" ? No newline in my file creation? + // echo "Hello World!" > ... likely adds newline. + // My previous tool 'write_to_file' wrote "Hello World!". It usually doesn't add newline unless specified? + // Let's verify start content. + if (s[0] != 'H') exit(101); + + // Fixed array + var arr = embed "tests/features/embed_data.txt" as u8[5]; + if (arr[0] != 'H') exit(102); + if (arr[4] != 'o') exit(103); + + // Slice + var sl = embed "tests/features/embed_data.txt" as u8[]; + if (sl.len < 5) exit(104); + if (sl.data[0] != 'H') exit(105); + + // Untyped regression + var raw = embed "tests/features/embed_data.txt"; + if (raw.len < 5) exit(106); + if (raw.data[0] != 'H') exit(107); + println "Typed embed tests passed"; } |
