Sha256: e19b50f658de4a66e08060c68eee6731e6f51a5b24ab0b918d08b8ff7a1431a4
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
require_relative '../../spec_helper' require_relative '../../../lib/reek/ast/sexp_formatter' RSpec.describe Reek::AST::SexpFormatter do describe '::format' do it 'formats a simple s-expression' do result = described_class.format sexp(:lvar, :foo) expect(result).to eq('foo') end it 'formats a more complex s-expression' do ast = sexp(:send, nil, :foo, sexp(:lvar, :bar)) result = described_class.format(ast) expect(result).to eq('foo(bar)') end it 'reduces very large ASTs to a single line' do ast = sexp(:if, sexp(:send, nil, :foo), sexp(:send, nil, :bar), sexp(:begin, sexp(:send, nil, :baz), sexp(:send, nil, :qux))) result = described_class.format ast expect(result).to eq 'if foo ... end' end it "doesn't reduce two-line ASTs" do ast = sexp(:def, 'my_method', sexp(:args)) result = described_class.format ast expect(result).to eq 'def my_method; end' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
reek-3.4.0 | spec/reek/ast/sexp_formatter_spec.rb |
reek-3.3.1 | spec/reek/ast/sexp_formatter_spec.rb |