-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdatatypes.pp
67 lines (55 loc) · 1.93 KB
/
datatypes.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
notify {'notbunk':}
# Test truth of various false things, and test str2bool a lot
if 0 {notice("zero is true")}
if -1 {notice("minus one is true")}
if Notify['notbunk'] {notice("defined resource reference is true")}
if Notify['bunk'] {notice('undefined resource reference is true')}
if Nonexistant['bunk'] {notice('nonexistant type of resource reference is true')}
if str2bool(0) {notice("str2bool 0 is true")}
if 'no' {notice("no is true")}
if str2bool('no') {notice("str2bool no is true")}
if undef {notice("undef is true")}
if str2bool(undef) {notice("str2bool undef is true")}
if nil {notice("nil is true")}
if 'nil' {notice("quoted nil is true")}
if '' {notice('empty string is true')}
#if str2bool(nil) {notice("str2bool nil is true")}
# if str2bool('nil') {notice("str2bool quoted nil is true")}
notice(false)
notice("and now for some pathology")
notice(str2bool(undef))
# notice(str2bool(true))
# notice(str2bool(false))
if [] {notice("empty array is true")}
if {} {notice("empty hash is true")}
$myregex = "blah"
# ugh can't put a regex in a variable?
case blah {
true: {notice("case value is true")}
false: {notice("case value is false")}
$myregex: {notice("case value is bl--")}
default: {notice("case value is neither")}
}
notice(bareword)
# notice(class)
notice(nil)
# this is funny: the class settings gets auto-declared. But it can't see the settings namespace! Even if you explicitly scope it from the top!
# class settings {
# notify{'hahahaha':}
# notify{"${::settings::modulepath}":}
# }
# ok functions aren't reserved words
notice(notice)
notice(str2bool)
notice(include)
notice("8.8"*"-8")
# lol
# class class { notify {'class class works':} }
# include class
#
# class node { notify {'class node works':} }
# include node
# Holy shit this one actually works, probs cause of having to quote node names
# node 'node' { notify {'node node works':} }
if !'st' { notice("not string is true")}
if !'' {notice("not empty string is true")}