Sha256: 309a9cfdbf1564c51e35e5faa134436df898f7ccdb68ec0e3efe4c8301149405

Contents?: true

Size: 1.48 KB

Versions: 20

Compression:

Stored size: 1.48 KB

Contents

require 'test_helper'

module Vedeu

  module Renderers

    describe EscapeSequence do

      let(:described) { Vedeu::Renderers::EscapeSequence }
      let(:instance)  { described.new(options) }
      let(:options)   { {} }
      let(:output)    {}

      describe '#initialize' do
        it { instance.must_be_instance_of(described) }
        it { instance.instance_variable_get('@options').must_equal(options) }
      end

      describe '#render' do
        subject { instance.render(output) }

        it { subject.must_be_instance_of(String) }

        context 'when there is no output' do
          it { subject.must_equal('') }
        end

        context 'when there is output' do
          let(:output) {
            [
              Vedeu::Char.new(value: 't', colour: { background: '#ff0000', foreground: '#ffffff' }),
              Vedeu::Char.new(value: 'e', colour: { background: '#ffff00', foreground: '#000000' }),
              Vedeu::Char.new(value: 's', colour: { background: '#00ff00', foreground: '#000000' }),
              Vedeu::Char.new(value: 't', colour: { background: '#00ffff', foreground: '#000000' }),
             ]
          }

          it { subject.must_equal(
            "\\e[38;2;255;255;255m\\e[48;2;255;0;0mt\n" \
            "\\e[38;2;0;0;0m\\e[48;2;255;255;0me\n"     \
            "\\e[38;2;0;0;0m\\e[48;2;0;255;0ms\n"       \
            "\\e[38;2;0;0;0m\\e[48;2;0;255;255mt\n")
          }
        end
      end

    end # EscapeSequence

  end # Renderers

end # Vedeu

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
vedeu-0.5.4 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.5.3 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.5.2 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.5.1 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.5.0 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.4.65 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.4.64 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.4.63 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.4.62 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.4.61 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.4.60 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.4.59 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.4.58 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.4.57 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.4.56 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.4.55 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.4.54 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.4.53 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.4.52 test/lib/vedeu/output/renderers/escape_sequence_test.rb
vedeu-0.4.51 test/lib/vedeu/output/renderers/escape_sequence_test.rb