Run tests on Travis on Linux

Fix the style of our only test.
This commit is contained in:
heinrich5991 2017-08-31 01:39:08 +02:00
parent a20db6ec56
commit fc44bfcc76
2 changed files with 21 additions and 12 deletions

View file

@ -8,13 +8,17 @@ addons:
apt:
packages:
- libfreetype6-dev
- libgtest-dev
- libsdl2-dev
script:
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install sdl2; fi
- if [ "$TRAVIS_OS_NAME" != "osx" ]; then mkdir gtest_build; cmake -E chdir gtest_build cmake /usr/src/gtest; cmake --build gtest_build; fi
- mkdir build
- cd build
- cmake -Werror=dev ..
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then cmake -Werror=dev ..; fi
- if [ "$TRAVIS_OS_NAME" != "osx" ]; then cmake -Werror=dev -DGTEST_LIBRARY=../gtest_build/libgtest.a -DGTEST_MAIN_LIBRARY=../gtest_build/libgtest_main.a ..; fi
- make everything
- if [ "$TRAVIS_OS_NAME" != "osx" ]; then make run_tests; fi
env:
global:
- CFLAGS="-Wdeclaration-after-statement -Werror"

View file

@ -6,7 +6,7 @@
class StripPathAndExtension : public ::testing::Test
{
protected:
void testEq(const char *pInput, const char *pOutput)
void Test(const char *pInput, const char *pOutput)
{
char aBuf[32];
IStorage::StripPathAndExtension(pInput, aBuf, sizeof(aBuf));
@ -14,22 +14,27 @@ protected:
}
};
TEST_F(StripPathAndExtension, WorksOnBareFilename) {
testEq("abc", "abc");
TEST_F(StripPathAndExtension, WorksOnBareFilename)
{
Test("abc", "abc");
}
TEST_F(StripPathAndExtension, NormalPath) {
testEq("/usr/share/teeworlds/data/mapres/grass_main.png", "grass_main");
TEST_F(StripPathAndExtension, NormalPath)
{
Test("/usr/share/teeworlds/data/mapres/grass_main.png", "grass_main");
}
TEST_F(StripPathAndExtension, NormalFile) {
testEq("winter_main.png", "winter_main");
TEST_F(StripPathAndExtension, NormalFile)
{
Test("winter_main.png", "winter_main");
}
TEST_F(StripPathAndExtension, DotInFolder) {
testEq("C:\\a.b\\c", "c");
TEST_F(StripPathAndExtension, DotInFolder)
{
Test("C:\\a.b\\c", "c");
}
TEST_F(StripPathAndExtension, DoubleDot) {
testEq("file.name.png", "file.name");
TEST_F(StripPathAndExtension, DoubleDot)
{
Test("file.name.png", "file.name");
}