summaryrefslogtreecommitdiff
path: root/src/test/test-env-replace.c
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>2013-02-11 21:40:59 +0100
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>2013-02-11 22:22:40 +0100
commit8354c34e14799593c85a638ef543b378ac97c6fe (patch)
tree2b9afe96b13fc72775b715ce64e3d43a809f9434 /src/test/test-env-replace.c
parenteb6d233862f33575b6a3e6c21ffaafa3f686248c (diff)
tests: more tests
tests for: parse_boolean env_name_is_valid Also convert assert to assert_se to make sure they are run even with optimization. (see commit 9b5d6bd909855543cba75a4469bff6f82845cf0d)
Diffstat (limited to 'src/test/test-env-replace.c')
-rw-r--r--src/test/test-env-replace.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/test-env-replace.c b/src/test/test-env-replace.c
index d6cb2892e7..0274e97618 100644
--- a/src/test/test-env-replace.c
+++ b/src/test/test-env-replace.c
@@ -195,6 +195,15 @@ static void test_env_clean(void) {
assert_se(e[5] == NULL);
}
+static void test_env_name_is_valid(void) {
+ assert_se(env_name_is_valid("test"));
+
+ assert_se(!env_name_is_valid(NULL));
+ assert_se(!env_name_is_valid(""));
+ assert_se(!env_name_is_valid("5_starting_with_a_number_is_wrong"));
+ assert_se(!env_name_is_valid("#ยค%&?_only_numbers_letters_and_underscore_allowed"));
+}
+
int main(int argc, char *argv[]) {
test_strv_env_delete();
test_strv_env_unset();
@@ -203,6 +212,7 @@ int main(int argc, char *argv[]) {
test_replace_env_arg();
test_normalize_env_assignment();
test_env_clean();
+ test_env_name_is_valid();
return 0;
}