Skip to content

Commit

Permalink
Merge pull request #111 from yui-knk/use_tmpdir
Browse files Browse the repository at this point in the history
Stop creating parser file on top directory
  • Loading branch information
yui-knk authored Oct 9, 2023
2 parents 0421f46 + 8706be6 commit b711f88
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions spec/lrama/command_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
require "tmpdir"

RSpec.describe Lrama::Command do
describe "#run" do
let(:outfile) { File.join(Dir.tmpdir, "parse.c") }
let(:o_option) { ["-o", "#{outfile}"] }

describe "a grammar file is specified" do
it "ends successfully" do
command = Lrama::Command.new
expect(command.run([fixture_path("command/basic.y")])).to be_nil
expect(command.run(o_option + [fixture_path("command/basic.y")])).to be_nil
end
end

Expand All @@ -12,7 +17,7 @@
File.open(fixture_path("command/basic.y")) do |f|
allow(STDIN).to receive(:read).and_return(f.read)
command = Lrama::Command.new
expect(command.run(["-", "test.y"])).to be_nil
expect(command.run(o_option + ["-", "test.y"])).to be_nil
end
end
end
Expand Down

0 comments on commit b711f88

Please sign in to comment.