mirror of
https://gitlab.com/klmp200/fish.git
synced 2025-07-11 20:29:23 +00:00
Début de l'intégration des tests
This commit is contained in:
20
fish_shell_tests/CMakeLists.txt
Normal file
20
fish_shell_tests/CMakeLists.txt
Normal file
@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
project(fish_shell_tests)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -c")
|
||||
|
||||
include_directories(
|
||||
"${source_dir}/googletest/include"
|
||||
"${source_dir}/googlemock/include"
|
||||
)
|
||||
|
||||
set(SOURCE_FILES_TESTS main.cpp FishCoreTests.cpp FishCoreTests.h)
|
||||
|
||||
add_executable(fish_tests ${SOURCE_FILES_TESTS})
|
||||
|
||||
target_link_libraries(fish_tests libgtest libgmock)
|
||||
|
||||
|
38
fish_shell_tests/FishCoreTests.cpp
Normal file
38
fish_shell_tests/FishCoreTests.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
//
|
||||
// Created by Antoine Bartuccio on 15/05/2017.
|
||||
//
|
||||
|
||||
#include "FishCoreTests.h"
|
||||
|
||||
//
|
||||
// Created by Antoine Bartuccio on 15/05/2017.
|
||||
//
|
||||
|
||||
#include "../fish_shell/fish_core.c"
|
||||
|
||||
|
||||
//TEST_F(FishCoreTests, split){
|
||||
// ASSERT_TRUE(true);
|
||||
//}
|
||||
|
||||
TEST(simple_split, split){
|
||||
char input[] = "git push --force";
|
||||
char *output[] = {
|
||||
(char *) "git",
|
||||
(char *) "push",
|
||||
(char *) "--force"
|
||||
};
|
||||
WordList *list = split(input, (char *) FISH_TOKENS);
|
||||
WordListElement *current = list->first;
|
||||
int i = 0;
|
||||
|
||||
ASSERT_FALSE(current == NULL);
|
||||
while(current != NULL){
|
||||
ASSERT_STREQ(current->word, output[i]);
|
||||
current = current->next;
|
||||
i++;
|
||||
}
|
||||
|
||||
freeWordList(list);
|
||||
|
||||
}
|
15
fish_shell_tests/FishCoreTests.h
Normal file
15
fish_shell_tests/FishCoreTests.h
Normal file
@ -0,0 +1,15 @@
|
||||
//
|
||||
// Created by Antoine Bartuccio on 15/05/2017.
|
||||
//
|
||||
|
||||
#ifndef FISH_FISH_CORE_TESTS_H
|
||||
#define FISH_FISH_CORE_TESTS_H
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
class FishCoreTests : public ::testing::Test {
|
||||
void SetUp() {}
|
||||
void TearDown(){}
|
||||
};
|
||||
|
||||
#endif //FISH_FISH_CORE_TESTS_H
|
16
fish_shell_tests/main.cpp
Normal file
16
fish_shell_tests/main.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
//
|
||||
// Created by Antoine Bartuccio on 15/05/2017.
|
||||
//
|
||||
|
||||
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
int main(int argc, char **argv){
|
||||
|
||||
printf("Je mange des patates");
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
int ret = RUN_ALL_TESTS();
|
||||
|
||||
return ret;
|
||||
}
|
Reference in New Issue
Block a user