removing trailing whitespace in cuke/ruby files
This commit is contained in:
@@ -23,7 +23,7 @@ class Cucumber::Ast::Table
|
||||
require_diff_lcs
|
||||
cell_matrix.extend(Diff::LCS)
|
||||
changes = cell_matrix.diff(other_table_cell_matrix).flatten
|
||||
|
||||
|
||||
inserted = 0
|
||||
missing = 0
|
||||
|
||||
@@ -43,7 +43,7 @@ class Cucumber::Ast::Table
|
||||
#change index so we interleave instead
|
||||
insert_row_pos = change.position + inserted + 1
|
||||
#insert_row_pos = change.position + missing #original
|
||||
|
||||
|
||||
inserted_row = change.element
|
||||
inserted_row.each{|cell| cell.status = :comment}
|
||||
cell_matrix.insert(insert_row_pos, inserted_row)
|
||||
@@ -66,7 +66,7 @@ class Cucumber::Ast::Table
|
||||
end
|
||||
|
||||
clear_cache!
|
||||
should_raise =
|
||||
should_raise =
|
||||
missing_row_pos && options[:missing_row] ||
|
||||
insert_row_pos && options[:surplus_row] ||
|
||||
missing_col && options[:missing_col] ||
|
||||
|
||||
+19
-19
@@ -20,7 +20,7 @@ ORIGIN = [1,1]
|
||||
|
||||
class Location
|
||||
attr_accessor :lon,:lat
|
||||
|
||||
|
||||
def initialize lon,lat
|
||||
@lat = lat
|
||||
@lon = lon
|
||||
@@ -44,16 +44,16 @@ def build_ways_from_table table
|
||||
#NOTE:
|
||||
#currently osrm crashes when processing an isolated oneway with just 2 nodes, so we use 4 edges
|
||||
#this is relatated to the fact that a oneway dead-end street doesn't make a lot of sense
|
||||
|
||||
|
||||
#if we stack ways on different x coordinates, routability tests get messed up, because osrm might pick a neighboring way if the one test can't be used.
|
||||
#instead we place all lines as a string on the same y coordinate. this prevents using neightboring ways.
|
||||
|
||||
|
||||
#a few nodes...
|
||||
node1 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(0+WAY_SPACING*ri)*@zoom, ORIGIN[1]
|
||||
node2 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(1+WAY_SPACING*ri)*@zoom, ORIGIN[1]
|
||||
node3 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(2+WAY_SPACING*ri)*@zoom, ORIGIN[1]
|
||||
node4 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(3+WAY_SPACING*ri)*@zoom, ORIGIN[1]
|
||||
node5 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(4+WAY_SPACING*ri)*@zoom, ORIGIN[1]
|
||||
node1 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(0+WAY_SPACING*ri)*@zoom, ORIGIN[1]
|
||||
node2 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(1+WAY_SPACING*ri)*@zoom, ORIGIN[1]
|
||||
node3 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(2+WAY_SPACING*ri)*@zoom, ORIGIN[1]
|
||||
node4 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(3+WAY_SPACING*ri)*@zoom, ORIGIN[1]
|
||||
node5 = OSM::Node.new make_osm_id, OSM_USER, OSM_TIMESTAMP, ORIGIN[0]+(4+WAY_SPACING*ri)*@zoom, ORIGIN[1]
|
||||
node1.uid = OSM_UID
|
||||
node2.uid = OSM_UID
|
||||
node3.uid = OSM_UID
|
||||
@@ -70,7 +70,7 @@ def build_ways_from_table table
|
||||
osm_db << node3
|
||||
osm_db << node4
|
||||
osm_db << node5
|
||||
|
||||
|
||||
#...with a way between them
|
||||
way = OSM::Way.new make_osm_id, OSM_USER, OSM_TIMESTAMP
|
||||
way.uid = OSM_UID
|
||||
@@ -79,22 +79,22 @@ def build_ways_from_table table
|
||||
way << node3
|
||||
way << node4
|
||||
way << node5
|
||||
|
||||
|
||||
tags = row.dup
|
||||
|
||||
|
||||
# remove tags that describe expected test result
|
||||
tags.reject! do |k,v|
|
||||
k =~ /^forw\b/ ||
|
||||
k =~ /^forw\b/ ||
|
||||
k =~ /^backw\b/ ||
|
||||
k =~ /^bothw\b/
|
||||
end
|
||||
|
||||
|
||||
##remove empty tags
|
||||
tags.reject! { |k,v| v=='' }
|
||||
|
||||
|
||||
# sort tag keys in the form of 'node/....'
|
||||
way_tags = { 'highway' => 'primary' }
|
||||
|
||||
|
||||
node_tags = {}
|
||||
tags.each_pair do |k,v|
|
||||
if k =~ /node\/(.*)/
|
||||
@@ -111,11 +111,11 @@ def build_ways_from_table table
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
way_tags['name'] = "w#{ri}"
|
||||
way << way_tags
|
||||
node3 << node_tags
|
||||
|
||||
|
||||
osm_db << way
|
||||
end
|
||||
end
|
||||
@@ -207,7 +207,7 @@ def osm_str
|
||||
@osm_str
|
||||
end
|
||||
|
||||
def write_osm
|
||||
def write_osm
|
||||
#write .oms file if needed
|
||||
Dir.mkdir DATA_FOLDER unless File.exist? DATA_FOLDER
|
||||
@osm_file = "#{DATA_FOLDER}/#{sanitized_scenario_title}_#{fingerprint}"
|
||||
@@ -262,7 +262,7 @@ def reprocess
|
||||
unless system "#{BIN_PATH}/osrm-prepare #{@osm_file}.osrm #{@osm_file}.osrm.restrictions 1>>#{PREPROCESS_LOG_FILE} 2>>#{PREPROCESS_LOG_FILE} #{PROFILES_PATH}/#{@profile}.lua"
|
||||
log "*** Exited with code #{$?.exitstatus}.", :preprocess
|
||||
raise PrepareError.new $?.exitstatus, "osrm-prepare exited with code #{$?.exitstatus}."
|
||||
end
|
||||
end
|
||||
log '', :preprocess
|
||||
end
|
||||
log_preprocess_done
|
||||
|
||||
@@ -10,13 +10,13 @@ class OSRMError < StandardError
|
||||
@log = log
|
||||
@extract = log_tail @log, @lines
|
||||
end
|
||||
|
||||
|
||||
def to_s
|
||||
"*** #{@msg}\nLast #{@lines} lines from #{@log}:\n#{@extract}\n"
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
||||
def log_tail path, n
|
||||
File.open(path) do |f|
|
||||
return f.tail(n).map { |line| " > #{line}" }.join "\n"
|
||||
|
||||
@@ -22,13 +22,13 @@ class FuzzyMatch
|
||||
return got =~ /#{$1}/
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def self.match_location got, want
|
||||
match( got[0], "#{want.lat} ~0.0025%" ) &&
|
||||
match( got[1], "#{want.lon} ~0.0025%" )
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class OSRMLauncher
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
||||
def launch
|
||||
Timeout.timeout(LAUNCH_TIMEOUT) do
|
||||
osrm_up
|
||||
@@ -27,7 +27,7 @@ class OSRMLauncher
|
||||
rescue Timeout::Error
|
||||
raise RoutedError.new "Launching osrm-routed timed out."
|
||||
end
|
||||
|
||||
|
||||
def shutdown
|
||||
Timeout.timeout(SHUTDOWN_TIMEOUT) do
|
||||
osrm_down
|
||||
@@ -36,8 +36,8 @@ class OSRMLauncher
|
||||
kill
|
||||
raise RoutedError.new "Shutting down osrm-routed timed out."
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
def osrm_up?
|
||||
if @pid
|
||||
`ps -o state -p #{@pid}`.split[1].to_s =~ /^[DRST]/
|
||||
|
||||
@@ -4,12 +4,12 @@ locations = nil
|
||||
|
||||
class OSMTestParserCallbacks < OSM::Callbacks
|
||||
locations = nil
|
||||
|
||||
|
||||
def self.locations
|
||||
if locations
|
||||
locations
|
||||
else
|
||||
#parse the test file, so we can later reference nodes and ways by name in tests
|
||||
#parse the test file, so we can later reference nodes and ways by name in tests
|
||||
locations = {}
|
||||
file = 'test/data/test.osm'
|
||||
callbacks = OSMTestParserCallbacks.new
|
||||
|
||||
@@ -128,7 +128,7 @@ def turn_list instructions
|
||||
r[0].to_s.gsub!(/^\d*/) do |match|
|
||||
types[match.to_i].to_s
|
||||
end
|
||||
end.join(',')
|
||||
end.join(',')
|
||||
end
|
||||
|
||||
def mode_list instructions
|
||||
|
||||
Reference in New Issue
Block a user