File: array_spec.rb

package info (click to toggle)
ruby-commander 5.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 364 kB
  • sloc: ruby: 1,969; makefile: 9
file content (20 lines) | stat: -rw-r--r-- 516 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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