mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
Run tests on Travis on Linux
Fix the style of our only test.
This commit is contained in:
parent
a20db6ec56
commit
fc44bfcc76
|
@ -8,13 +8,17 @@ addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- libfreetype6-dev
|
- libfreetype6-dev
|
||||||
|
- libgtest-dev
|
||||||
- libsdl2-dev
|
- libsdl2-dev
|
||||||
script:
|
script:
|
||||||
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install sdl2; fi
|
- 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
|
- mkdir build
|
||||||
- cd 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
|
- make everything
|
||||||
|
- if [ "$TRAVIS_OS_NAME" != "osx" ]; then make run_tests; fi
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- CFLAGS="-Wdeclaration-after-statement -Werror"
|
- CFLAGS="-Wdeclaration-after-statement -Werror"
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
class StripPathAndExtension : public ::testing::Test
|
class StripPathAndExtension : public ::testing::Test
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
void testEq(const char *pInput, const char *pOutput)
|
void Test(const char *pInput, const char *pOutput)
|
||||||
{
|
{
|
||||||
char aBuf[32];
|
char aBuf[32];
|
||||||
IStorage::StripPathAndExtension(pInput, aBuf, sizeof(aBuf));
|
IStorage::StripPathAndExtension(pInput, aBuf, sizeof(aBuf));
|
||||||
|
@ -14,22 +14,27 @@ protected:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(StripPathAndExtension, WorksOnBareFilename) {
|
TEST_F(StripPathAndExtension, WorksOnBareFilename)
|
||||||
testEq("abc", "abc");
|
{
|
||||||
|
Test("abc", "abc");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(StripPathAndExtension, NormalPath) {
|
TEST_F(StripPathAndExtension, NormalPath)
|
||||||
testEq("/usr/share/teeworlds/data/mapres/grass_main.png", "grass_main");
|
{
|
||||||
|
Test("/usr/share/teeworlds/data/mapres/grass_main.png", "grass_main");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(StripPathAndExtension, NormalFile) {
|
TEST_F(StripPathAndExtension, NormalFile)
|
||||||
testEq("winter_main.png", "winter_main");
|
{
|
||||||
|
Test("winter_main.png", "winter_main");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(StripPathAndExtension, DotInFolder) {
|
TEST_F(StripPathAndExtension, DotInFolder)
|
||||||
testEq("C:\\a.b\\c", "c");
|
{
|
||||||
|
Test("C:\\a.b\\c", "c");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(StripPathAndExtension, DoubleDot) {
|
TEST_F(StripPathAndExtension, DoubleDot)
|
||||||
testEq("file.name.png", "file.name");
|
{
|
||||||
|
Test("file.name.png", "file.name");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue