@@ -10,12 +10,44 @@ def get_relative_dir(sampleprojects_tests_dir)
1010 sampleprojects_tests_dir . relative_path_from ( base_dir )
1111end
1212
13+ RSpec . describe "TestSomething C++ without excludes" do
14+ next if skip_cpp_tests
15+ cpp_lib_path = sampleproj_path + "TestSomething"
16+ cpp_library = ArduinoCI ::CppLibrary . new ( cpp_lib_path ,
17+ Pathname . new ( "my_fake_arduino_lib_dir" ) ,
18+ [ ] )
19+ context "cpp_files" do
20+ it "finds cpp files in directory" do
21+ testsomething_cpp_files = [
22+ Pathname . new ( "TestSomething/test-something.cpp" ) ,
23+ Pathname . new ( "TestSomething/excludeThis/exclude-this.cpp" )
24+ ]
25+ relative_paths = cpp_library . cpp_files . map { |f | get_relative_dir ( f ) }
26+ expect ( relative_paths ) . to match_array ( testsomething_cpp_files )
27+ end
28+ end
29+
30+ context "unit tests" do
31+ it "can't build due to files that should have been excluded" do
32+ config = ArduinoCI ::CIConfig . default . from_example ( cpp_lib_path )
33+ path = config . allowable_unittest_files ( cpp_library . test_files ) . first
34+ compiler = config . compilers_to_use . first
35+ result = cpp_library . build_for_test_with_configuration ( path ,
36+ [ ] ,
37+ compiler ,
38+ config . gcc_config ( "uno" ) )
39+ expect ( result ) . to be nil
40+ end
41+ end
42+
43+ end
44+
1345RSpec . describe "TestSomething C++" do
1446 next if skip_cpp_tests
1547 cpp_lib_path = sampleproj_path + "TestSomething"
1648 cpp_library = ArduinoCI ::CppLibrary . new ( cpp_lib_path ,
1749 Pathname . new ( "my_fake_arduino_lib_dir" ) ,
18- [ "excludeThis" ] )
50+ [ "excludeThis" ] . map ( & Pathname . method ( :new ) ) )
1951 context "cpp_files" do
2052 it "finds cpp files in directory" do
2153 testsomething_cpp_files = [ Pathname . new ( "TestSomething/test-something.cpp" ) ]
0 commit comments