diff options
| author | rykad <> | 2026-01-17 22:26:25 +0000 |
|---|---|---|
| committer | rykad <> | 2026-01-17 22:26:25 +0000 |
| commit | 454f75cb2288e171cd4d40879938ea970e3b9019 (patch) | |
| tree | 1cdbb963309de4cfaa1aeb223315cbba28ebcd58 /tests/core/encoding | |
| parent | d46c547264c2be4ff46887d96354e653dbd6069d (diff) | |
core:encoding/base64: add support for url variant
Diffstat (limited to 'tests/core/encoding')
| -rw-r--r-- | tests/core/encoding/base64/base64.odin | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/core/encoding/base64/base64.odin b/tests/core/encoding/base64/base64.odin index ed1bee8af..93b3afb59 100644 --- a/tests/core/encoding/base64/base64.odin +++ b/tests/core/encoding/base64/base64.odin @@ -50,4 +50,19 @@ test_roundtrip :: proc(t: ^testing.T) { for v, i in decoded { testing.expect_value(t, v, values[i]) } -}
\ No newline at end of file +} + +@(test) +test_base64url :: proc(t: ^testing.T) { + plain := ">>>" + url := "Pj4-" + + encoded := base64.encode(transmute([]byte)plain, base64.ENC_URL_TABLE) + defer delete(encoded) + testing.expect_value(t, encoded, url) + + decoded := string(base64.decode(url, base64.DEC_URL_TABLE)) + defer delete(decoded) + testing.expect_value(t, decoded, plain) + +} |