source: src/puppetcode/environments/test/modules/stdlib/spec/acceptance/chop_spec.rb@ a250eb4

0.5 app-cordova debian/bullseye debian/jessie
Last change on this file since a250eb4 was 1c22429, checked in by Joachim Langenbach <joachim.langenbach@…>, 10 years ago
  • gnuboat_epd adds the apt repository from gnuboat to install epd-fuse package
  • Property mode set to 100755
File size: 1.1 KB
Line 
1#! /usr/bin/env ruby -S rspec
2require 'spec_helper_acceptance'
3
4describe 'chop function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5 describe 'success' do
6 it 'should eat the last character' do
7 pp = <<-EOS
8 $input = "test"
9 if size($input) != 4 {
10 fail("Size of ${input} is not 4.")
11 }
12 $output = chop($input)
13 if size($output) != 3 {
14 fail("Size of ${input} is not 3.")
15 }
16 EOS
17
18 apply_manifest(pp, :catch_failures => true)
19 end
20
21 it 'should eat the last two characters of \r\n' do
22 pp = <<-'EOS'
23 $input = "test\r\n"
24 if size($input) != 6 {
25 fail("Size of ${input} is not 6.")
26 }
27 $output = chop($input)
28 if size($output) != 4 {
29 fail("Size of ${input} is not 4.")
30 }
31 EOS
32
33 apply_manifest(pp, :catch_failures => true)
34 end
35
36 it 'should not fail on empty strings' do
37 pp = <<-EOS
38 $input = ""
39 $output = chop($input)
40 EOS
41
42 apply_manifest(pp, :catch_failures => true)
43 end
44 end
45end
Note: See TracBrowser for help on using the repository browser.