-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_fetch_source_files.cmake
62 lines (46 loc) · 1.78 KB
/
test_fetch_source_files.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
include(add_target.cmake)
include(unit_test_for_cmake/unit-test.cmake)
function(test_sources_alone)
fetch_source_files(sources test.cpp)
expect_streq("test.cpp" "${sources}")
fetch_source_files(sources "test.cpp;foo.txt")
expect_streq("test.cpp;foo.txt" "${sources}")
fetch_source_files(sources "test.cpp" "foo.txt")
expect_streq("test.cpp;foo.txt" "${sources}")
fetch_source_files(sources)
expect_empty("${sources}")
fetch_source_files(out_sources "test.cpp")
expect_streq("test.cpp" "${out_sources}")
fetch_source_files(out_sources "test.cpp;foo.txt")
expect_streq("test.cpp;foo.txt" "${out_sources}")
endfunction()
function(test_groups_alone)
fetch_source_files(sources "///")
expect_empty("${sources}")
fetch_source_files(sources "//")
expect_empty("${sources}")
fetch_source_files(sources "//" "a//" "/b//" "a/b/c//" "/a/b//")
expect_empty("${sources}")
fetch_source_files(sources "//;a//;/b//;a/b/c//;/a/b//")
expect_empty("${sources}")
endfunction()
function(test_options)
fetch_source_files(sources "test.cpp:header" "test.txt:file")
expect_streq("test.cpp;test.txt" "${sources}")
fetch_source_files(sources "test.cpp:header;test.txt:file")
expect_streq("test.cpp;test.txt" "${sources}")
fetch_source_files(
sources "test.cpp:header;test.txt:file//") # last one interpreted as group
expect_streq("test.cpp" "${sources}")
endfunction()
function(test_all_together)
fetch_source_files(sources "test.h" "b//" "test.cpp:header" "/a:c//"
"test.txt")
expect_streq("test.h;test.cpp;test.txt" "${sources}")
fetch_source_files(sources "test.h;b:c//;test.cpp:header;/a//;test.txt")
expect_streq("test.h;test.cpp;test.txt" "${sources}")
endfunction()
test_sources_alone()
test_groups_alone()
test_options()
test_all_together()