File tree Expand file tree Collapse file tree 4 files changed +79
-0
lines changed Expand file tree Collapse file tree 4 files changed +79
-0
lines changed Original file line number Diff line number Diff line change @@ -357,6 +357,30 @@ Unacceptable input example:
357357C:/whatever
358358` ` `
359359
360+ # ### `Stdlib::Filemode`
361+
362+ Matches valid four digit modes in octal format.
363+
364+ Acceptable input examples:
365+
366+ ` ` ` shell
367+ 0644
368+ ` ` `
369+
370+ ` ` ` shell
371+ 1777
372+ ` ` `
373+
374+ Unacceptable input examples:
375+
376+ ` ` ` shell
377+ 644
378+ ` ` `
379+
380+ ` ` ` shell
381+ 0999
382+ ` ` `
383+
360384# ### `Stdlib::Windowspath`
361385
362386Matches paths on Windows operating systems.
Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ if Puppet ::Util ::Package . versioncmp ( Puppet . version , '4.5.0' ) >= 0
4+ describe 'test::filemode' , type : :class do
5+ describe 'valid modes' do
6+ %w{
7+ 0644
8+ 1644
9+ 2644
10+ 4644
11+ 0123
12+ 0777
13+ } . each do |value |
14+ describe value . inspect do
15+ let ( :params ) { { value : value } }
16+ it { is_expected . to compile }
17+ end
18+ end
19+ end
20+
21+ describe 'invalid modes' do
22+ context 'garbage inputs' do
23+ [
24+ nil ,
25+ [ nil ] ,
26+ [ nil , nil ] ,
27+ { 'foo' => 'bar' } ,
28+ { } ,
29+ '' ,
30+ "ネット" ,
31+ '644' ,
32+ '7777' ,
33+ '1' ,
34+ '22' ,
35+ '333' ,
36+ '55555' ,
37+ '0x123' ,
38+ '0649' ,
39+ ] . each do |value |
40+ describe value . inspect do
41+ let ( :params ) { { value : value } }
42+ it { is_expected . to compile . and_raise_error ( /parameter 'value' expects a match for Stdlib::Filemode/ ) }
43+ end
44+ end
45+ end
46+ end
47+ end
48+ end
Original file line number Diff line number Diff line change 1+ # Class to test the Stdlib::Filemode type alias
2+ class test::filemode (
3+ Stdlib::Filemode $value,
4+ ) {
5+ notice (" Success" )
6+ }
Original file line number Diff line number Diff line change 1+ type Stdlib::Filemode = Pattern[/^[0124]{1 }[0-7]{3 }$/]
You can’t perform that action at this time.
0 commit comments