source: other-projects/hathitrust/vagrant-hadoop-cluster/trunk/modules/stdlib/spec/acceptance/chop_spec.rb@ 30903

Last change on this file since 30903 was 30903, checked in by davidb, 7 years ago

Vagrant provisioning files for a 4-node Hadoop cluster. See README.txt for more details

  • Property svn:executable set to *
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.