Skip to content

Commit 0314005

Browse files
committed
More rubocopy and rspec cleanup.
1 parent b38752d commit 0314005

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
398398

399399
### Fixed
400400
- Malformed YAML (duplicate unittests section) now has no duplicate section
401-
- arduino_ci_remote.rb script now has correct arguments in build_for_test_with_configuration
401+
- arduino_ci_remote.rb script now has correct arguments in build_for_test
402402

403403

404404
## [0.1.8] - 2018-04-03

exe/arduino_ci.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,7 @@ def perform_unit_tests(cpp_library, file_config)
430430
unittest_name = unittest_path.basename.to_s
431431
puts "--------------------------------------------------------------------------------"
432432
attempt_multiline("Unit testing #{unittest_name} with #{gcc_binary} for #{p}") do
433-
exe = cpp_library.build_for_test_with_configuration(
434-
unittest_path,
435-
gcc_binary
436-
)
433+
exe = cpp_library.build_for_test(unittest_path, gcc_binary)
437434
puts
438435
unless exe
439436
puts "Last command: #{cpp_library.last_cmd}"

lib/arduino_ci/cpp_library.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,9 @@ def test_args(aux_libraries, ci_gcc_config)
488488
# The dependent libraries configuration is appended with data from library.properties internal to the library under test
489489
#
490490
# @param test_file [Pathname] The path to the file containing the unit tests
491-
# @param aux_libraries [Array<Pathname>] The external Arduino libraries required by this project
492-
# @param ci_gcc_config [Hash] The GCC config object
491+
# @param gcc_binary [String] name of a compiler
493492
# @return [Pathname] path to the compiled test executable
494-
def build_for_test_with_configuration(test_file, gcc_binary)
493+
def build_for_test(test_file, gcc_binary)
495494
executable = Pathname.new("#{BUILD_DIR}/#{test_file.basename}.bin").expand_path
496495
File.delete(executable) if File.exist?(executable)
497496
arg_sets = ["-std=c++0x", "-o", executable.to_s, "-L#{BUILD_DIR}", "-DARDUINO=100"]
@@ -517,6 +516,7 @@ def build_for_test_with_configuration(test_file, gcc_binary)
517516
# The dependent libraries configuration is appended with data from library.properties internal to the library under test
518517
#
519518
# @param aux_libraries [Array<Pathname>] The external Arduino libraries required by this project
519+
# @param gcc_binary [String] name of a compiler
520520
# @param ci_gcc_config [Hash] The GCC config object
521521
# @return [Pathname] path to the compiled test executable
522522
def build_share_library_with_configuration(aux_libraries, gcc_binary, ci_gcc_config)

spec/cpp_library_spec.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ def verified_install(backend, path)
4545
config = ArduinoCI::CIConfig.default.from_example(cpp_lib_path)
4646
path = config.allowable_unittest_files(@cpp_library.test_files).first
4747
compiler = config.compilers_to_use.first
48-
result = @cpp_library.build_for_test_with_configuration(path,
49-
[],
50-
compiler,
51-
config.gcc_config("uno"))
48+
result = @cpp_library.build_shared_library(path, [], compiler, config.gcc_config("uno"))
49+
expect(result).to be nil
50+
result = @cpp_library.build_for_test(path, compiler)
5251
expect(result).to be nil
5352
end
5453
end
@@ -276,7 +275,9 @@ def verified_install(backend, path)
276275
expected = path.basename.to_s.include?("good")
277276
config.compilers_to_use.each do |compiler|
278277
it "tests #{File.basename(path)} with #{compiler} expecting #{expected}" do
279-
exe = @cpp_library.build_for_test_with_configuration(path, [], compiler, config.gcc_config("uno"))
278+
exe = @cpp_library.build_shared_library(path, [], compiler, config.gcc_config("uno"))
279+
expect(exe).not_to be nil
280+
exe = @cpp_library.build_for_test(path, compiler)
280281
expect(exe).not_to be nil
281282
expect(@cpp_library.run_test_file(exe)).to eq(expected)
282283
end

spec/testsomething_unittests_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@
7474

7575
before(:each) do
7676
@cpp_library = backend.install_local_library(cpp_lib_path)
77-
@exe = @cpp_library.build_for_test_with_configuration(path, [], compiler, config.gcc_config("uno"))
77+
@cpp.library.build_shared_library(path, [], compiler, config.gcc_config("uno"))
78+
@exe = @cpp_library.build_for_test(path, compiler)
7879
end
7980

8081
# extra debug for c++ failures

0 commit comments

Comments
 (0)