2017-05-29 14:19:42 +00:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
#include "../fish_shell/fish_types.h"
|
2017-05-29 17:42:02 +00:00
|
|
|
#include "../fish_shell/fish_settings.h"
|
|
|
|
|
|
|
|
TEST(free_settings_Test, freeSettings){
|
2017-05-29 17:09:19 +00:00
|
|
|
Settings *s = getSettings();
|
2017-05-29 17:42:02 +00:00
|
|
|
|
2017-05-29 17:09:19 +00:00
|
|
|
ASSERT_STREQ(s->PS1, "->");
|
2017-05-29 17:42:02 +00:00
|
|
|
|
2017-05-29 17:09:19 +00:00
|
|
|
freeSettings(s);
|
2017-05-29 17:42:02 +00:00
|
|
|
|
2017-05-29 17:09:19 +00:00
|
|
|
ASSERT_STRNE(s->PS1, "->");
|
2017-05-29 17:42:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(extract_variable_Test, extractVariable){
|
|
|
|
ASSERT_TRUE(extractVariable((char*) "P4T3", (char*) "PS1") == NULL);
|
|
|
|
ASSERT_STREQ(extractVariable((char*) "../fish_shell_tests/fishrc", (char*) "PS1"), "sli->");
|
|
|
|
ASSERT_TRUE(extractVariable((char*) "../fish_shell_tests/fishrc", (char*) "P1ZZ4") == NULL);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(get_settings_Test, getSettings){
|
|
|
|
Settings* s = getSettings();
|
|
|
|
ASSERT_FALSE(s ==NULL);
|
|
|
|
ASSERT_FALSE(s->passwd == NULL);
|
|
|
|
freeSettings(s);
|
2017-05-29 17:09:19 +00:00
|
|
|
}
|