Sha256: db78f84da558ccfd90ce6e0c1d4b785125bd49ca024d0702f368a1f349aa185f
Contents?: true
Size: 1.59 KB
Versions: 4
Compression:
Stored size: 1.59 KB
Contents
require 'spec_helper' describe LintTrap::Linter::CPPCheck do let(:container){LintTrap::Container::Fake.new} subject(:linter){described_class.new(container: container)} shared_examples '#lint' do context 'when linting a bad file' do let(:file){fixture_path('bad.cpp')} it 'generates lint' do expect{|b| linter.lint([file], &b)}.to yield_successive_args( { file: file, line: '3', column: nil, length: nil, rule: 'unassignedVariable', severity: 'style', message: "Variable 'p' is not assigned a value." }, { file: file, line: '4', column: nil, length: nil, rule: 'uninitvar', severity: 'error', message: 'Uninitialized variable: p' }, { file: file, line: '1', column: nil, length: nil, rule: 'unusedFunction', severity: 'style', message: "The function 'f' is never used." } ) end end context 'when linting a good file' do let(:file){fixture_path('good.cpp')} it 'generates no lint' do expect{|b| linter.lint([file], &b)}.to_not yield_control end end end context 'with docker container', if: !ENV['SKIP_DOCKER'] do let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)} it_behaves_like '#lint' end context 'without a docker container', if: ENV['SKIP_DOCKER'] do it_behaves_like '#lint' end end
Version data entries
4 entries across 4 versions & 1 rubygems