summaryrefslogtreecommitdiffstats
path: root/acceptance/tests/ticket_5027_warn_on_dynamic_scope.rb
blob: a918f078816bee9ed268a007e119cbd611c9708e (plain)
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
test_name "#5027: Issue warnings when using dynamic scope"

step "Apply dynamic scoping manifest on agents"
apply_manifest_on agents, %q{
  $foo = 'foo_value'

  class a {
      $bar = 'bar_value'

      include b
  }

  class b inherits c {
      notify { $baz: } # should not generate a warning -- inherited from class c
      notify { $bar: } # should generate a warning -- uses dynamic scoping
      notify { $foo: } # should not generate a warning -- comes from top scope
  }

  class c {
      $baz = 'baz_value'
  }

  include a
}

step "Verify deprecation warning"
fail_test "Deprecation warning not issued" unless
  stdout.include? 'warning: Dynamic lookup'