1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/spec/ruby/library/ripper/sexp_spec.rb

14 lines
441 B
Ruby
Raw Normal View History

2020-07-27 15:41:08 -04:00
require_relative '../../spec_helper'
require 'ripper'
describe "Ripper.sexp" do
it "returns an s-expression for a method declaration" do
expected = [:program,
[[:def,
[:@ident, "hello", [1, 4]],
[:params, nil, nil, nil, nil, nil, nil, nil],
[:bodystmt, [[:@int, "42", [1, 11]]], nil, nil, nil]]]]
Ripper.sexp("def hello; 42; end").should == expected
end
end