Skip to content

Commit

Permalink
Add test case for help command
Browse files Browse the repository at this point in the history
  • Loading branch information
ydah committed Sep 13, 2023
1 parent 43bf7ce commit 976ac9d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions spec/lrama/option_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,40 @@
end
end

describe "help option" do
it "print help and exit" do
result = Open3.popen3("ruby", exe_path("lrama"), "--help") do |stdin, stdout, stderr, wait_thr|
stdout.read
end
expect(result).to eq(<<~HELP)
Lrama is LALR (1) parser generator written by Ruby.
Usage: lrama [options] FILE
Tuning the Parser:
-S, --skeleton=FILE specify the skeleton to use
-t reserved, do nothing
Output:
-h, --header=[FILE] also produce a header file named FILE
-d also produce a header file
-r, --report=THINGS also produce details on the automaton
--report-file=FILE also produce details on the automaton output to a file named FILE
-o, --output=FILE leave output to FILE
--trace=THINGS also output trace logs at runtime
-v reserved, do nothing
Error Recovery:
-e enable error recovery
Other options:
-V, --version output version information and exit
--help display this help and exit
HELP
end
end

describe "#validate_report" do
let(:option_parser) { Lrama::OptionParser.new }

Expand Down

0 comments on commit 976ac9d

Please sign in to comment.