Sha256: 3d84ee04e471dc1f13c45c3cfa4531a694e7bbcdbd8b9d8b24a1298be696d338

Contents?: true

Size: 1.54 KB

Versions: 17

Compression:

Stored size: 1.54 KB

Contents

# derived from test_graveyard/unit/preprocessinator_extractor_test.rb

require 'spec_helper'
require 'ceedling/preprocessinator_extractor'

describe PreprocessinatorExtractor do
  context "#extract_base_file_from_preprocessed_expansion" do
    it "should extract text from the original file and keep #pragma statements" do
      file_path = "path/to/WANT.c"
      input_str = [
        '# 1 "some/file/we/do/not/care/about.c" 5',
        '#pragma shit',
        'some_text_we_do_not_want();',
        '# 1 "some/file/we/DO/WANT.c" 99999',
        'some_text_we_do_not_want();',
        '#pragma want',
        'some_awesome_text_we_want_so_hard();',
        'holy_crepes_more_awesome_text();',
        '# oh darn',
        '# 1 "some/useless/file.c" 9',
        'a set of junk',
        'more junk',
        '# 1 "holy/shoot/yes/WANT.c" 10',
        'some_additional_awesome_want_text();',
      ]

      expect_str = [
        'some_text_we_do_not_want();',
        '#pragma want',
        'some_awesome_text_we_want_so_hard();',
        'holy_crepes_more_awesome_text();',
        'some_additional_awesome_want_text();',
      ]

      expect(File).to receive(:readlines).with(file_path).and_return( input_str )

      expect(subject.extract_base_file_from_preprocessed_expansion(file_path)).to eq expect_str
    end

    # These were originally hinted at by the old test, but we don't see anything
    # in the implementation that does this. They are here as reminders in the future.
    # # xit "should ignore formatting"
    # # xit "should ignore whitespace"
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ceedling-0.30.0 spec/preprocessinator_extractor_spec.rb
ceedling-0.28.3 spec/preprocessinator_extractor_spec.rb
ceedling-0.28.2 spec/preprocessinator_extractor_spec.rb
ceedling-0.28.1 spec/preprocessinator_extractor_spec.rb
ceedling-0.27.0 spec/preprocessinator_extractor_spec.rb
ceedling-0.25.0 spec/preprocessinator_extractor_spec.rb
ceedling-0.24.0 spec/preprocessinator_extractor_spec.rb
ceedling-0.22.0 spec/preprocessinator_extractor_spec.rb
ceedling-0.21.0 spec/preprocessinator_extractor_spec.rb
ceedling-0.20.3 spec/preprocessinator_extractor_spec.rb
ceedling-0.20.2 spec/preprocessinator_extractor_spec.rb
ceedling-0.19.0 spec/preprocessinator_extractor_spec.rb
ceedling-0.18.0 spec/preprocessinator_extractor_spec.rb
ceedling-0.17.0 spec/preprocessinator_extractor_spec.rb
ceedling-0.16.0 spec/preprocessinator_extractor_spec.rb
ceedling-0.15.6 spec/preprocessinator_extractor_spec.rb
ceedling-0.15.4 spec/preprocessinator_extractor_spec.rb