Sha256: 29f43e7738330ff6d9bc1efe3ae74e5997a1a49be5f4d2a9d534820832cf5a43

Contents?: true

Size: 516 Bytes

Versions: 2

Compression:

Stored size: 516 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Array do
  describe '#parse' do
    it 'should seperate a list of words into an array' do
      expect(Array.parse('just a test')).to eq(%w(just a test))
    end

    it 'should preserve escaped whitespace' do
      expect(Array.parse('just a\ test')).to eq(['just', 'a test'])
    end

    it 'should match %w behavior with multiple backslashes' do
      str = 'just a\\ test'
      expect(Array.parse(str)).to eq(['just', 'a test'])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
commander-5.0.0 spec/core_ext/array_spec.rb
commander-4.6.0 spec/core_ext/array_spec.rb