Align to new rubocop rules

pull/84/head
Andre Richter 4 years ago
parent a33f693e1c
commit b8f7764bbb
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E

@ -1871,7 +1871,7 @@ diff -uNr 12_exceptions_part1_groundwork/tests/panic_exit_success/mod.rs 13_inte
diff -uNr 12_exceptions_part1_groundwork/tests/runner.rb 13_integrated_testing/tests/runner.rb
--- 12_exceptions_part1_groundwork/tests/runner.rb
+++ 13_integrated_testing/tests/runner.rb
@@ -0,0 +1,139 @@
@@ -0,0 +1,143 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
@ -1906,7 +1906,7 @@ diff -uNr 12_exceptions_part1_groundwork/tests/runner.rb 13_integrated_testing/t
+ puts "#{INDENT}-------------------------------------------------------------------"
+ print INDENT
+ print '🦀 '
+ print @output.join('').gsub("\n", "\n" + INDENT)
+ print @output.join('').gsub("\n", "\n#{INDENT}")
+ end
+
+ def finish(error)
@ -1927,6 +1927,8 @@ diff -uNr 12_exceptions_part1_groundwork/tests/runner.rb 13_integrated_testing/t
+# Executes tests with console I/O.
+class ConsoleTest < Test
+ def initialize(binary, qemu_cmd, test_name, console_subtests)
+ super()
+
+ @binary = binary
+ @qemu_cmd = qemu_cmd
+ @test_name = test_name
@ -1937,7 +1939,7 @@ diff -uNr 12_exceptions_part1_groundwork/tests/runner.rb 13_integrated_testing/t
+ end
+
+ def format_test_name(number, name)
+ formatted_name = number.to_s.rjust(3) + '. ' + name
+ formatted_name = "#{number.to_s.rjust(3)}. #{name}"
+ formatted_name.ljust(63, '.')
+ end
+
@ -1970,6 +1972,8 @@ diff -uNr 12_exceptions_part1_groundwork/tests/runner.rb 13_integrated_testing/t
+ MAX_WAIT_SECS = 5
+
+ def initialize(binary, qemu_cmd, test_name)
+ super()
+
+ @binary = binary
+ @qemu_cmd = qemu_cmd
+ @test_name = test_name
@ -1999,7 +2003,7 @@ diff -uNr 12_exceptions_part1_groundwork/tests/runner.rb 13_integrated_testing/t
+##--------------------------------------------------------------------------------------------------
+binary = ARGV.last
+test_name = binary.gsub(modulor{.*deps/}, '').split('-')[0]
+console_test_file = 'tests/' + test_name + '.rb'
+console_test_file = "tests/#{test_name}.rb"
+qemu_cmd = ARGV.join(' ')
+
+test_runner = if File.exist?(console_test_file)

@ -32,7 +32,7 @@ class Test
puts "#{INDENT}-------------------------------------------------------------------"
print INDENT
print '🦀 '
print @output.join('').gsub("\n", "\n" + INDENT)
print @output.join('').gsub("\n", "\n#{INDENT}")
end
def finish(error)
@ -53,6 +53,8 @@ end
# Executes tests with console I/O.
class ConsoleTest < Test
def initialize(binary, qemu_cmd, test_name, console_subtests)
super()
@binary = binary
@qemu_cmd = qemu_cmd
@test_name = test_name
@ -63,7 +65,7 @@ class ConsoleTest < Test
end
def format_test_name(number, name)
formatted_name = number.to_s.rjust(3) + '. ' + name
formatted_name = "#{number.to_s.rjust(3)}. #{name}"
formatted_name.ljust(63, '.')
end
@ -96,6 +98,8 @@ class RawTest < Test
MAX_WAIT_SECS = 5
def initialize(binary, qemu_cmd, test_name)
super()
@binary = binary
@qemu_cmd = qemu_cmd
@test_name = test_name
@ -125,7 +129,7 @@ end
##--------------------------------------------------------------------------------------------------
binary = ARGV.last
test_name = binary.gsub(%r{.*deps/}, '').split('-')[0]
console_test_file = 'tests/' + test_name + '.rb'
console_test_file = "tests/#{test_name}.rb"
qemu_cmd = ARGV.join(' ')
test_runner = if File.exist?(console_test_file)

@ -32,7 +32,7 @@ class Test
puts "#{INDENT}-------------------------------------------------------------------"
print INDENT
print '🦀 '
print @output.join('').gsub("\n", "\n" + INDENT)
print @output.join('').gsub("\n", "\n#{INDENT}")
end
def finish(error)
@ -53,6 +53,8 @@ end
# Executes tests with console I/O.
class ConsoleTest < Test
def initialize(binary, qemu_cmd, test_name, console_subtests)
super()
@binary = binary
@qemu_cmd = qemu_cmd
@test_name = test_name
@ -63,7 +65,7 @@ class ConsoleTest < Test
end
def format_test_name(number, name)
formatted_name = number.to_s.rjust(3) + '. ' + name
formatted_name = "#{number.to_s.rjust(3)}. #{name}"
formatted_name.ljust(63, '.')
end
@ -96,6 +98,8 @@ class RawTest < Test
MAX_WAIT_SECS = 5
def initialize(binary, qemu_cmd, test_name)
super()
@binary = binary
@qemu_cmd = qemu_cmd
@test_name = test_name
@ -125,7 +129,7 @@ end
##--------------------------------------------------------------------------------------------------
binary = ARGV.last
test_name = binary.gsub(%r{.*deps/}, '').split('-')[0]
console_test_file = 'tests/' + test_name + '.rb'
console_test_file = "tests/#{test_name}.rb"
qemu_cmd = ARGV.join(' ')
test_runner = if File.exist?(console_test_file)

@ -10,5 +10,5 @@ group :uart do
end
group :development do
gem 'rubocop', require: false
gem 'rubocop', '>= 0.90.0', require: false
end

@ -79,7 +79,7 @@ class TutorialCrate
private
def testable?
Dir.exist?(@folder + '/tests')
Dir.exist?("#{@folder}/tests")
end
end
@ -120,14 +120,14 @@ class DevTool
end
end
def fmt(check = false)
def fmt(check: false)
args = '-- --check' if check
@crates.each { |c| c.fmt(args) }
end
def fmt_check
fmt(true)
fmt(check: true)
end
def make(bsp = nil)
@ -214,7 +214,7 @@ class DevTool
return nil if folders.empty?
crates = folders.map { |d| d + '/Cargo.toml' }.sort
crates = folders.map { |d| "#{d}/Cargo.toml" }.sort
crates.each do |c|
unless File.exist?(c)
puts "Crate not found: #{c}"

@ -52,7 +52,7 @@ class MiniPush
@target_serial.sync = true
rescue Errno::EACCES => e
puts
puts '[MP] 🚫 ' + e.message + " - Maybe try with 'sudo'"
puts "[MP] 🚫 #{e.message} - Maybe try with 'sudo'"
exit
else
puts
@ -148,7 +148,7 @@ class MiniPush
connetion_reset
puts
puts '[MP] ⚡ ' + 'Connection Error: Reinsert the USB serial again'.light_red
puts "[MP] ⚡ #{'Connection Error: Reinsert the USB serial again'.light_red}"
end
# When the serial is still powered.
@ -156,7 +156,7 @@ class MiniPush
connetion_reset
puts
puts '[MP] ⚡ ' + 'Protocol Error: Remove and insert the USB serial again'.light_red
puts "[MP] ⚡ #{'Protocol Error: Remove and insert the USB serial again'.light_red}"
sleep(1) while serial_connected?
end
@ -164,7 +164,7 @@ class MiniPush
connetion_reset
puts
puts '[MP] ⚡ ' + "Unexpected Error: #{error.inspect}".light_red
puts "[MP] ⚡ #{"Unexpected Error: #{error.inspect}".light_red}"
end
public

Loading…
Cancel
Save