1 #! /usr/bin/env ruby -S rspec
2 require 'spec_helper_acceptance'
4 describe 'chop function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
6 it 'should eat the last character' do
10 fail("Size of ${input} is not 4.")
12 $output = chop($input)
13 if size($output) != 3 {
14 fail("Size of ${input} is not 3.")
18 apply_manifest(pp, :catch_failures => true)
21 it 'should eat the last two characters of \r\n' do
24 if size($input) != 6 {
25 fail("Size of ${input} is not 6.")
27 $output = chop($input)
28 if size($output) != 4 {
29 fail("Size of ${input} is not 4.")
33 apply_manifest(pp, :catch_failures => true)
36 it 'should not fail on empty strings' do
39 $output = chop($input)
42 apply_manifest(pp, :catch_failures => true)