Skip to content

Commit 2b3f837

Browse files
committed
CppLibrary.examples_dir
1 parent f9df387 commit 2b3f837

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/arduino_ci/cpp_library.rb

+5
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ def path
8282
@backend.lib_dir + name_on_disk
8383
end
8484

85+
# @return [String] The parent directory of all examples
86+
def examples_dir
87+
path + "examples"
88+
end
89+
8590
# Determine whether a library is present in the lib dir
8691
#
8792
# Note that `true` doesn't guarantee that the library is valid/installed

spec/cpp_library_spec.rb

+7
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,13 @@ def verified_install(backend, path)
217217
end
218218
end
219219

220+
context "examples_dir" do
221+
it "locates the examples directory" do
222+
relative_path = @cpp_library.examples_dir.relative_path_from(@base_dir)
223+
expect(relative_path.to_s).to eq("#{sampleproject}/examples")
224+
end
225+
end
226+
220227
context "test_files" do
221228
it "finds cpp files in directory" do
222229
relative_paths = @cpp_library.test_files.map { |f| f.relative_path_from(@base_dir) }

0 commit comments

Comments
 (0)