2015-06-18 13:34:54 -04:00
|
|
|
|
2015-06-19 15:54:18 -04:00
|
|
|
#include "catch.hpp"
|
2015-06-18 13:34:54 -04:00
|
|
|
#include "../src/settings/LangConfig.h"
|
2015-06-19 15:54:18 -04:00
|
|
|
|
|
|
|
TEST_CASE("Language Config Library")
|
2015-06-18 13:34:54 -04:00
|
|
|
{
|
2015-06-19 15:54:18 -04:00
|
|
|
LangConfig *config = new LangConfig();
|
2015-06-18 13:34:54 -04:00
|
|
|
|
2015-06-19 15:54:18 -04:00
|
|
|
SECTION("GetLangList()")
|
2015-06-18 13:34:54 -04:00
|
|
|
{
|
2015-06-19 15:54:18 -04:00
|
|
|
StringMap list = config->GetLangList();
|
|
|
|
REQUIRE(list.size() > 0);
|
2015-06-18 13:34:54 -04:00
|
|
|
}
|
2015-06-19 15:54:18 -04:00
|
|
|
|
|
|
|
SECTION("GetLang()")
|
2015-06-18 13:34:54 -04:00
|
|
|
{
|
2015-06-19 15:54:18 -04:00
|
|
|
string lang = config->GetLang();
|
|
|
|
REQUIRE(lang == "");
|
2015-06-18 13:34:54 -04:00
|
|
|
}
|
|
|
|
|
2015-06-19 15:54:18 -04:00
|
|
|
SECTION("SetLang()")
|
|
|
|
{
|
|
|
|
string lang="cpp";
|
|
|
|
config->SetLang(lang);
|
|
|
|
REQUIRE(lang == config->GetLang());
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("GetLangByFile()")
|
|
|
|
{
|
|
|
|
wxFileName file("foo.cpp");
|
|
|
|
|
|
|
|
string lang = config->GetLangByFile(file);
|
|
|
|
REQUIRE("cpp" == lang);
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("GetLangByName()")
|
|
|
|
{
|
|
|
|
string lang = config->GetLangByName("C / C++");
|
|
|
|
REQUIRE("cpp" == lang);
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("GetCurrentLangName()")
|
|
|
|
{
|
2015-06-19 16:37:24 -04:00
|
|
|
config->SetLang("cpp");
|
|
|
|
REQUIRE("C / C++" == config->GetCurrentLangName());
|
2015-06-19 15:54:18 -04:00
|
|
|
}
|
2015-06-18 13:34:54 -04:00
|
|
|
|
2015-06-19 15:54:18 -04:00
|
|
|
SECTION("GetLexerMap()")
|
|
|
|
{
|
2015-06-19 16:37:24 -04:00
|
|
|
JsonValue lexer_map = config->GetLexerMap("none");
|
|
|
|
REQUIRE(lexer_map.isNull());
|
2015-06-19 15:54:18 -04:00
|
|
|
|
2015-06-19 16:37:24 -04:00
|
|
|
lexer_map = config->GetLexerMap("cpp");
|
|
|
|
REQUIRE(lexer_map.isArray());
|
2015-06-19 15:54:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
SECTION("GetKeywordList()")
|
|
|
|
{
|
2015-06-19 16:37:24 -04:00
|
|
|
JsonValue keyword_list = config->GetKeywordList("none");
|
|
|
|
REQUIRE(keyword_list.isNull());
|
2015-06-19 15:54:18 -04:00
|
|
|
|
2015-06-19 16:37:24 -04:00
|
|
|
keyword_list = config->GetKeywordList("cpp");
|
|
|
|
REQUIRE(keyword_list.isArray());
|
2015-06-19 15:54:18 -04:00
|
|
|
}
|
2015-06-18 13:34:54 -04:00
|
|
|
}
|