Sha256: 727297c75dd71a598e9af8ac5741e1229bfb4e6ccbd689252c1742923de393bc

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require 'test_helper'

module Vedeu
  describe Char do
    let(:instance)   { Char.new(attributes) }
    let(:attributes) {
      {
        colour: { foreground: '#ffff00', background: '#0000ff' },
        parent: {
          colour: {
            foreground: '#00ff00',
            background: '#ff00ff'
          },
          style: []
        },
        style:  [],
        value:  value,
      }
    }
    let(:value) { 'a' }

    describe '#initialize' do
      it 'returns a new instance of Char' do
        instance.must_be_instance_of(Char)
      end
    end

    describe '#to_s' do
      it 'returns a String' do
        instance.to_s.must_be_instance_of(String)
      end

      it 'returns the escape sequences and content' do
        # - char colours and style as set in Stream#chars.
        # - the value.
        # - the colours and style of the line which the Char belongs to.
        instance.to_s.must_equal(
          "\e[38;2;255;255;0m\e[48;2;0;0;255m" \
          "a" \
          "\e[38;2;0;255;0m\e[48;2;255;0;255m"
        )
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.2.4 test/lib/vedeu/models/char_test.rb