mirror of
https://github.com/sbrow/envr.git
synced 2026-06-27 10:38:33 -04:00
test: Added missing tests.
This commit is contained in:
@@ -3,7 +3,7 @@ package main
|
||||
import "core:fmt"
|
||||
import "core:testing"
|
||||
|
||||
TEST_KEY_DIR :: "/tmp/envr-test-keys"
|
||||
TEST_KEY_DIR :: "fixtures/keys"
|
||||
|
||||
@(test)
|
||||
test_parse_ed25519_public_key :: proc(t: ^testing.T) {
|
||||
@@ -70,3 +70,39 @@ test_read_wire_string :: proc(t: ^testing.T) {
|
||||
testing.expect(t, s2 == "", "expected empty string")
|
||||
}
|
||||
|
||||
@(test)
|
||||
test_is_encrypted_key_encrypted :: proc(t: ^testing.T) {
|
||||
testing.expect(
|
||||
t,
|
||||
is_encrypted_key(TEST_KEY_DIR + "/test_ed25519_encrypted"),
|
||||
"encrypted key should be detected as encrypted",
|
||||
)
|
||||
}
|
||||
|
||||
@(test)
|
||||
test_is_encrypted_key_unencrypted :: proc(t: ^testing.T) {
|
||||
testing.expect(
|
||||
t,
|
||||
!is_encrypted_key(TEST_KEY_DIR + "/test_ed25519"),
|
||||
"unencrypted key should not be detected as encrypted",
|
||||
)
|
||||
}
|
||||
|
||||
@(test)
|
||||
test_is_encrypted_key_rsa_unencrypted :: proc(t: ^testing.T) {
|
||||
testing.expect(
|
||||
t,
|
||||
!is_encrypted_key(TEST_KEY_DIR + "/test_rsa"),
|
||||
"unencrypted RSA key should not be detected as encrypted",
|
||||
)
|
||||
}
|
||||
|
||||
@(test)
|
||||
test_is_encrypted_key_missing_file :: proc(t: ^testing.T) {
|
||||
testing.expect(
|
||||
t,
|
||||
is_encrypted_key(TEST_KEY_DIR + "/nonexistent"),
|
||||
"missing file should be treated as encrypted (fail-safe)",
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user