Skip to content

Commit

Permalink
Create placeholder spec for fixed index out of bounds error
Browse files Browse the repository at this point in the history
  • Loading branch information
acook committed Feb 23, 2022
1 parent 8c5e4c3 commit c6ea46d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions spec/formatter_spec.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require "./spec_helper"
require "../src/entry"
require "../src/options"

def new_formatter(path, options = Lister::Options.new)
Lister::Formatter.new(path, options)
end

describe Lister::Formatter do
klass = Lister::Formatter

describe "#line" do
pending "should not attempt to insert color codes past the end of the line" do
long_filename = "asdfghjklqwertyuiopzxcvbnm"
opts = Lister::Options.new
# stub out terminal width somehow
opts.terminal.width
# make entry
entry = Entry.new long_filename, opts
formatter = new_formatter(long_filename, opts)
formatter.line(entry, entry.name.size, 0)
# should generate a filename much lonager than the line, which before the fix would error out
# like "index out of range" for String#insert
end
end
end

0 comments on commit c6ea46d

Please sign in to comment.