Sha256: 001a4e1665a0bcf9276f0764c1e8f606d11c8abad161d79d3826e0126b450955

Contents?: true

Size: 624 Bytes

Versions: 6

Compression:

Stored size: 624 Bytes

Contents

# encoding: utf-8

RSpec.describe TTY::Cursor, '#move' do
  subject(:cursor) { described_class }

  it "doesn't move for point (0, 0)" do
    expect(cursor.move(0, 0)).to eq('')
  end

  it "moves only to the right" do
    expect(cursor.move(2, 0)).to eq("\e[2C")
  end

  it "moves right and up" do
    expect(cursor.move(2, 3)).to eq("\e[2C\e[3A")
  end

  it "moves right and down" do
    expect(cursor.move(2, -3)).to eq("\e[2C\e[3B")
  end

  it "moves left and up" do
    expect(cursor.move(-2, 3)).to eq("\e[2D\e[3A")
  end

  it "moves left and down" do
    expect(cursor.move(-2, -3)).to eq("\e[2D\e[3B")
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tty-cursor-0.6.0 spec/unit/move_spec.rb
tty-cursor-0.5.0 spec/unit/move_spec.rb
tty-cursor-0.4.0 spec/unit/move_spec.rb
tty-cursor-0.3.0 spec/unit/move_spec.rb
tty-cursor-0.2.0 spec/unit/move_spec.rb
tty-cursor-0.1.0 spec/unit/move_spec.rb