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:
|
||||
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"
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue