poafloc

poafloc - Parser Of Arguments For Lines Of Commands
git clone git://git.dimitrijedobrota.com/poafloc.git
Log | Files | Refs | README | LICENSE

CMakeLists.txt (3560B)


      1 cmake_minimum_required(VERSION 3.14)
      2 
      3 project(poaflocTests LANGUAGES CXX)
      4 
      5 include(../cmake/project-is-top-level.cmake)
      6 include(../cmake/folders.cmake)
      7 
      8 # ---- Dependencies ----
      9 
     10 if(PROJECT_IS_TOP_LEVEL)
     11   find_package(poafloc REQUIRED)
     12   enable_testing()
     13 endif()
     14 
     15 # ---- Tests ----
     16 
     17 add_executable(poafloc_test source/poafloc_test.cpp)
     18 target_link_libraries(poafloc_test PRIVATE poafloc::poafloc)
     19 target_compile_features(poafloc_test PRIVATE cxx_std_20)
     20 
     21 add_test(NAME poafloc_test_empty COMMAND poafloc_test)
     22 set_tests_properties(poafloc_test_empty PROPERTIES PASS_REGULAR_EXPRESSION "init\nnoargs\nend\nsuccess")
     23 
     24 add_test(NAME poafloc_test_arg_one COMMAND poafloc_test a1)
     25 set_tests_properties(poafloc_test_arg_one PROPERTIES PASS_REGULAR_EXPRESSION "init\narg:a1\nend\nsuccess")
     26 
     27 add_test(NAME poafloc_test_arg_two COMMAND poafloc_test a1 a2)
     28 set_tests_properties(poafloc_test_arg_two PROPERTIES PASS_REGULAR_EXPRESSION "init\narg:a1\narg:a2\nend\nsuccess")
     29 
     30 add_test(NAME poafloc_test_short COMMAND poafloc_test -s)
     31 set_tests_properties(poafloc_test_short PROPERTIES PASS_REGULAR_EXPRESSION "init\ns\nnoargs\nend\nsuccess")
     32 
     33 add_test(NAME poafloc_test_long COMMAND poafloc_test --long)
     34 set_tests_properties(poafloc_test_long PROPERTIES PASS_REGULAR_EXPRESSION "init\nl\nnoargs\nend\nsuccess")
     35 
     36 add_test(NAME poafloc_test_short_arg COMMAND poafloc_test -a a1)
     37 set_tests_properties(poafloc_test_short_arg PROPERTIES PASS_REGULAR_EXPRESSION "init\na:a1\nnoargs\nend\nsuccess")
     38 
     39 add_test(NAME poafloc_test_long_arg COMMAND poafloc_test --arg a1)
     40 set_tests_properties(poafloc_test_long_arg PROPERTIES PASS_REGULAR_EXPRESSION "init\na:a1\nnoargs\nend\nsuccess")
     41 
     42 add_test(NAME poafloc_test_short_arg_equal COMMAND poafloc_test -aa1)
     43 set_tests_properties(poafloc_test_short_arg_equal PROPERTIES PASS_REGULAR_EXPRESSION "init\na:a1\nnoargs\nend\nsuccess")
     44 
     45 add_test(NAME poafloc_test_long_arg_equal COMMAND poafloc_test --arg=a1)
     46 set_tests_properties(poafloc_test_long_arg_equal PROPERTIES PASS_REGULAR_EXPRESSION "init\na:a1\nnoargs\nend\nsuccess")
     47 
     48 add_test(NAME poafloc_test_short_arg_without COMMAND poafloc_test -a)
     49 set_tests_properties(poafloc_test_short_arg_without PROPERTIES WILL_FAIL TRUE)
     50 
     51 add_test(NAME poafloc_test_long_arg_without COMMAND poafloc_test --arg)
     52 set_tests_properties(poafloc_test_long_arg_without PROPERTIES WILL_FAIL TRUE)
     53 
     54 add_test(NAME poafloc_test_short_opt COMMAND poafloc_test -oa1)
     55 set_tests_properties(poafloc_test_short_opt PROPERTIES PASS_REGULAR_EXPRESSION "init\no:a1\nnoargs\nend\nsuccess")
     56 
     57 add_test(NAME poafloc_test_long_opt COMMAND poafloc_test --opt=a1)
     58 set_tests_properties(poafloc_test_long_opt PROPERTIES PASS_REGULAR_EXPRESSION "init\no:a1\nnoargs\nend\nsuccess")
     59 
     60 add_test(NAME poafloc_test_short_opt_without COMMAND poafloc_test -o)
     61 set_tests_properties(poafloc_test_short_opt_without PROPERTIES PASS_REGULAR_EXPRESSION "init\no:default\nnoargs\nend\nsuccess")
     62 
     63 add_test(NAME poafloc_test_long_opt_without COMMAND poafloc_test --opt)
     64 set_tests_properties(poafloc_test_long_opt_without PROPERTIES PASS_REGULAR_EXPRESSION "init\no:default\nnoargs\nend\nsuccess")
     65 
     66 add_test(NAME poafloc_test_short_opt_after COMMAND poafloc_test -o a1)
     67 set_tests_properties(poafloc_test_short_opt_after PROPERTIES PASS_REGULAR_EXPRESSION "init\no:default\narg:a1\nend\nsuccess")
     68 
     69 add_test(NAME poafloc_test_long_opt_after COMMAND poafloc_test --opt a1)
     70 set_tests_properties(poafloc_test_long_opt_after PROPERTIES PASS_REGULAR_EXPRESSION "init\no:default\narg:a1\nend\nsuccess")
     71 
     72 # ---- End-of-file commands ----
     73 
     74 add_folders(Test)