Update Mac build info, add better-working test system, merge duplicate html & php languages

This commit is contained in:
Tim Warren 2015-06-19 15:54:18 -04:00
parent d08e344744
commit f5022077f6
12 changed files with 9506 additions and 127 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ nbproject/*
config/*_json.h config/*_json.h
config/json2c config/json2c
**/*.exe **/*.exe
tests/runner

View File

@ -1,10 +1,6 @@
language: cpp language: cpp
before_install: before_install:
# Setup virtual x server for gui testing
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
# Define TRAVIS variable for workarounds # Define TRAVIS variable for workarounds
- export CXXFLAGS="$CXXFLAGS -DTRAVIS" - export CXXFLAGS="$CXXFLAGS -DTRAVIS"
@ -14,13 +10,6 @@ before_install:
- if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi - if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi
- if [ "$CXX" = "g++" ]; then sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 98; fi - if [ "$CXX" = "g++" ]; then sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 98; fi
# Setup cpputest
#- git clone git://github.com/cpputest/cpputest.git
#- cd cpputest/cpputest_build
#- cmake ..
#- make && sudo make install
#- cd ../../
# Install dependencies # Install dependencies
- sudo apt-get -qq install libwxgtk3.0-dev libwxgtk3.0-0 libssh2-1-dev - sudo apt-get -qq install libwxgtk3.0-dev libwxgtk3.0-0 libssh2-1-dev
@ -29,4 +18,4 @@ compiler:
- gcc - gcc
- clang - clang
script: make clean dev script: make clean run-tests

View File

@ -5,21 +5,22 @@ Use [this script](http://devernay.free.fr/hacks/xcodelegacy/) to install older S
## Additional configure flags for compiling wxWidgets ## Additional configure flags for compiling wxWidgets
### Building on 10.8 or newer ### Building on 10.8 or newer
* --with-macosx-version-min=10.5 * --with-macosx-version-min=10.7
* --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.5.sdk * --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
### Building on 10.5 to 10.7 ### Building on 10.7
* --with-macosx-version-min=10.5 * --with-macosx-version-min=10.7
* --with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk * --with-macosx-sdk=/Developer/SDKs/MacOSX10.7.sdk
## Recommended flags for development/debugging (Assuming OS X > 10.7) ## Recommended flags for development/debugging (Assuming OS X > 10.7)
* --enable-debug
* --enable-debug_gdb * --enable-debug_gdb
* --enable-profile * --enable-profile
* --disable-compat28 * --disable-compat28
* --disable-shared * --disable-shared
* --without-liblzma * --without-liblzma
* --without-webviewwebkit * --without-webviewwebkit
* --with-macosx-version-min=10.5 * --with-macosx-version-min=10.7
* --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.5.sdk * --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk

View File

@ -38,7 +38,7 @@ endif
# Platform compiler flags # Platform compiler flags
ifeq ($(OS),Darwin) ifeq ($(OS),Darwin)
CXX = $(shell wx-config --cxx) -D__WXMAC__ -std=gnu++11 CXX = $(shell wx-config --cxx) -D__WXMAC__ -D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_ -std=gnu++11
LDLIBS += /usr/local/lib/libssh2.a LDLIBS += /usr/local/lib/libssh2.a
else else
LDLIBS += -lssh2 LDLIBS += -lssh2
@ -157,13 +157,13 @@ $(TESTS):
$(foreach var, $(TEST_SRC), $(CXX) $(CXXFLAGS) $(WX_CXXFLAGS) -c -o $(patsubst %.cpp,%.o,$(var)) $(var);) $(foreach var, $(TEST_SRC), $(CXX) $(CXXFLAGS) $(WX_CXXFLAGS) -c -o $(patsubst %.cpp,%.o,$(var)) $(var);)
.PHONY: tests .PHONY: tests
tests: LDLIBS += -lstdc++ -lCppUTestExt -lCppUTest
tests: $(TESTS) json_wrapper $(BASE_LIB) $(WIDGET_LIB) tests: $(TESTS) json_wrapper $(BASE_LIB) $(WIDGET_LIB)
$(patsubst g++,clang++, $(CXX)) $(CXXFLAGS) $(WX_CXXFLAGS) tests/main.cpp $(TESTS) $(WIDGET_LIB) $(BASE_LIB) $(WX_LDLIBS) $(LDLIBS) -o tests/runner $(CXX) $(CXXFLAGS) $(WX_CXXFLAGS) tests/main.cpp $(TESTS) $(WIDGET_LIB) $(BASE_LIB) $(WX_LDLIBS) $(LDLIBS) -o tests/runner
run-tests: tests run-tests: tests
./tests/runner -v ./tests/runner -s
./tests/runner -r compact
clean: clean:
rm -f *.res rm -f *.res

View File

@ -35,10 +35,11 @@ If you want maximum compatibility with older versions of OS X,
view [the guide](./Mac-compatibility-build.md). Otherwise, these simpler view [the guide](./Mac-compatibility-build.md). Otherwise, these simpler
steps should work fine for a local build. steps should work fine for a local build.
1. Download the latest wxWidgets source 1. Download the latest wxWidgets source (>= 3.0.2)
2. Make a new directory in the source tree, like `wxmac` 2. Run `export CXX="clang++ -std=c++11 -stdlib=libc++"` to compile with clang for better C++11 support
3. Run `../configure --disable-shared --disable-webviewwebkit --disable-compat28` in the new directory 3. Make a new directory in the source tree, like `wxmac`
4. Run `make && make install` 4. Run `../configure --disable-shared --disable-webviewwebkit --disable-compat28` in the new directory
5. Run `make && make install`
Install libssh2 (Using homebrew): Install libssh2 (Using homebrew):

File diff suppressed because one or more lines are too long

View File

@ -133,7 +133,6 @@ private:
Glob_lexer_map["css"] = wxSTC_LEX_CSS; Glob_lexer_map["css"] = wxSTC_LEX_CSS;
Glob_lexer_map["fortran"] = wxSTC_LEX_FORTRAN; Glob_lexer_map["fortran"] = wxSTC_LEX_FORTRAN;
Glob_lexer_map["haskell"] = wxSTC_LEX_HASKELL; Glob_lexer_map["haskell"] = wxSTC_LEX_HASKELL;
Glob_lexer_map["html"] = wxSTC_LEX_HTML;
Glob_lexer_map["java"] = wxSTC_LEX_CPP; Glob_lexer_map["java"] = wxSTC_LEX_CPP;
Glob_lexer_map["js"] = wxSTC_LEX_CPP; Glob_lexer_map["js"] = wxSTC_LEX_CPP;
Glob_lexer_map["lisp"] = wxSTC_LEX_LISP; Glob_lexer_map["lisp"] = wxSTC_LEX_LISP;

View File

@ -23,7 +23,7 @@ public:
void ApplyTheme(string lang, string theme=""); void ApplyTheme(string lang, string theme="");
string GetCurrentLang(); string GetCurrentLang();
void SetCurrentLang(string name); void SetCurrentLang(string name);
private: protected:
StringConstMap::iterator lexerMapIt; StringConstMap::iterator lexerMapIt;
LangConfig *lang_config = nullptr; LangConfig *lang_config = nullptr;
ThemeConfig *theme_config = nullptr; ThemeConfig *theme_config = nullptr;

View File

@ -1,23 +1,13 @@
#include <CppUTest/TestHarness.h> #include "catch.hpp"
#include "../src/base/settings/Config.h" #include "../src/base/settings/Config.h"
TEST_GROUP(Config) TEST_CASE ("Base config class load json")
{ {
TyroConfig *config; TyroConfig *config = new TyroConfig();
void setup() SECTION("Create Base Config Class")
{ {
config = new TyroConfig(); config->LoadJson("{\"foo\":\"bar\"}");
REQUIRE(config->GetRoot().isObject());
} }
void teardown()
{
delete config;
}
};
TEST(Config, Create)
{
config->LoadJson("{\"foo\":\"bar\"}");
CHECK(config->GetRoot().isObject());
} }

View File

@ -1,51 +1,56 @@
#include <CppUTest/TestHarness.h> #include "catch.hpp"
#include "../src/settings/LangConfig.h" #include "../src/settings/LangConfig.h"
TEST_GROUP(LangConfig)
{
LangConfig *config;
void setup() TEST_CASE("Language Config Library")
{
LangConfig *config = new LangConfig();
SECTION("GetLangList()")
{ {
config = new LangConfig(); StringMap list = config->GetLangList();
REQUIRE(list.size() > 0);
} }
void teardown()
SECTION("GetLang()")
{ {
delete config; string lang = config->GetLang();
REQUIRE(lang == "");
} }
};
TEST(LangConfig, GetLangList) SECTION("SetLang()")
{ {
StringMap list = config->GetLangList(); string lang="cpp";
CHECK(list.size() > 0); config->SetLang(lang);
} REQUIRE(lang == config->GetLang());
}
TEST(LangConfig, GetLang)
{ SECTION("GetLangByFile()")
string lang; {
lang = config->GetLang(); wxFileName file("foo.cpp");
CHECK_EQUAL(lang, "");
} string lang = config->GetLangByFile(file);
REQUIRE("cpp" == lang);
TEST(LangConfig, SetLang) }
{
string lang="cpp"; SECTION("GetLangByName()")
config->SetLang(lang); {
string lang = config->GetLangByName("C / C++");
CHECK_EQUAL(lang, config->GetLang()); REQUIRE("cpp" == lang);
} }
TEST(LangConfig, GetLangByFile) SECTION("GetCurrentLangName()")
{ {
wxFileName file("foo.cpp");
}
string lang = config->GetLangByFile(file);
CHECK_EQUAL("cpp", lang); SECTION("GetLexerMap()")
} {
TEST(LangConfig, GetLangByName) }
{
string lang = config->GetLangByName("C / C++"); SECTION("GetKeywordList()")
CHECK_EQUAL("cpp", lang); {
}
} }

9427
tests/catch.hpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,2 @@
#include <CppUTest/CommandLineTestRunner.h> #define CATCH_CONFIG_MAIN
#include "catch.hpp"
int main(int argc, char *argv[])
{
MemoryLeakWarningPlugin::turnOffNewDeleteOverloads();
return CommandLineTestRunner::RunAllTests(argc, argv);
}
IMPORT_TEST_GROUP(Config);
IMPORT_TEST_GROUP(LangConfig);