puppet 5.0.1-x86-mingw32 → 5.1.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/lib/puppet/agent.rb +1 -0
  3. data/lib/puppet/defaults.rb +1 -1
  4. data/lib/puppet/functions.rb +6 -7
  5. data/lib/puppet/functions/all.rb +100 -0
  6. data/lib/puppet/functions/any.rb +105 -0
  7. data/lib/puppet/functions/defined.rb +3 -3
  8. data/lib/puppet/functions/new.rb +2 -1
  9. data/lib/puppet/functions/reduce.rb +31 -0
  10. data/lib/puppet/functions/tree_each.rb +200 -0
  11. data/lib/puppet/module.rb +30 -0
  12. data/lib/puppet/parser/functions/new.rb +67 -0
  13. data/lib/puppet/parser/functions/reduce.rb +31 -0
  14. data/lib/puppet/parser/relationship.rb +2 -2
  15. data/lib/puppet/parser/resource.rb +39 -10
  16. data/lib/puppet/parser/scope.rb +1 -1
  17. data/lib/puppet/pops/evaluator/access_operator.rb +11 -4
  18. data/lib/puppet/pops/evaluator/collector_transformer.rb +1 -1
  19. data/lib/puppet/pops/evaluator/evaluator_impl.rb +4 -4
  20. data/lib/puppet/pops/evaluator/relationship_operator.rb +1 -1
  21. data/lib/puppet/pops/evaluator/runtime3_converter.rb +3 -3
  22. data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +1 -1
  23. data/lib/puppet/pops/loader/module_loaders.rb +1 -1
  24. data/lib/puppet/pops/loader/static_loader.rb +1 -2
  25. data/lib/puppet/pops/loaders.rb +1 -2
  26. data/lib/puppet/pops/lookup/context.rb +1 -1
  27. data/lib/puppet/pops/lookup/lookup_adapter.rb +2 -1
  28. data/lib/puppet/pops/model/ast.rb +440 -436
  29. data/lib/puppet/pops/model/factory.rb +140 -140
  30. data/lib/puppet/pops/pcore.rb +1 -2
  31. data/lib/puppet/pops/resource/param.rb +1 -1
  32. data/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
  33. data/lib/puppet/pops/serialization/from_data_converter.rb +0 -12
  34. data/lib/puppet/pops/time/timestamp.rb +29 -17
  35. data/lib/puppet/pops/types/annotatable.rb +2 -2
  36. data/lib/puppet/pops/types/annotation.rb +8 -8
  37. data/lib/puppet/pops/types/class_loader.rb +3 -3
  38. data/lib/puppet/pops/types/implementation_registry.rb +1 -1
  39. data/lib/puppet/pops/types/iterable.rb +2 -2
  40. data/lib/puppet/pops/types/p_binary_type.rb +2 -2
  41. data/lib/puppet/pops/types/p_init_type.rb +238 -0
  42. data/lib/puppet/pops/types/p_meta_type.rb +14 -11
  43. data/lib/puppet/pops/types/p_object_type.rb +15 -15
  44. data/lib/puppet/pops/types/p_sem_ver_range_type.rb +2 -2
  45. data/lib/puppet/pops/types/p_sem_ver_type.rb +2 -2
  46. data/lib/puppet/pops/types/p_sensitive_type.rb +2 -2
  47. data/lib/puppet/pops/types/p_timespan_type.rb +6 -6
  48. data/lib/puppet/pops/types/p_timestamp_type.rb +6 -2
  49. data/lib/puppet/pops/types/p_type_set_type.rb +10 -9
  50. data/lib/puppet/pops/types/ruby_generator.rb +6 -5
  51. data/lib/puppet/pops/types/ruby_method.rb +2 -2
  52. data/lib/puppet/pops/types/string_converter.rb +1 -1
  53. data/lib/puppet/pops/types/tree_iterators.rb +250 -0
  54. data/lib/puppet/pops/types/type_calculator.rb +13 -13
  55. data/lib/puppet/pops/types/type_factory.rb +26 -7
  56. data/lib/puppet/pops/types/type_formatter.rb +9 -4
  57. data/lib/puppet/pops/types/type_parser.rb +8 -3
  58. data/lib/puppet/pops/types/type_set_reference.rb +2 -2
  59. data/lib/puppet/pops/types/types.rb +168 -109
  60. data/lib/puppet/provider/package/gem.rb +10 -9
  61. data/lib/puppet/provider/package/pip.rb +12 -3
  62. data/lib/puppet/provider/package/yum.rb +9 -1
  63. data/lib/puppet/resource/capability_finder.rb +30 -11
  64. data/lib/puppet/type/file.rb +21 -13
  65. data/lib/puppet/util/execution.rb +67 -14
  66. data/lib/puppet/util/suidmanager.rb +1 -0
  67. data/lib/puppet/version.rb +1 -1
  68. data/locales/puppet.pot +130 -66
  69. data/man/man5/puppet.conf.5 +1 -1
  70. data/spec/fixtures/unit/provider/package/yum/yum-check-update-simple.txt +1 -0
  71. data/spec/integration/parser/collection_spec.rb +40 -1
  72. data/spec/shared_contexts/types_setup.rb +41 -2
  73. data/spec/unit/agent_spec.rb +11 -0
  74. data/spec/unit/file_bucket/dipper_spec.rb +13 -4
  75. data/spec/unit/functions/all_spec.rb +97 -0
  76. data/spec/unit/functions/any_spec.rb +109 -0
  77. data/spec/unit/functions/hiera_spec.rb +5 -0
  78. data/spec/unit/functions/new_spec.rb +66 -0
  79. data/spec/unit/functions/tree_each_spec.rb +444 -0
  80. data/spec/unit/module_spec.rb +29 -0
  81. data/spec/unit/pops/serialization/serialization_spec.rb +2 -2
  82. data/spec/unit/pops/serialization/to_from_hr_spec.rb +2 -2
  83. data/spec/unit/pops/types/iterable_spec.rb +9 -9
  84. data/spec/unit/pops/types/p_init_type_spec.rb +285 -0
  85. data/spec/unit/pops/types/p_object_type_spec.rb +8 -8
  86. data/spec/unit/pops/types/p_sensitive_type_spec.rb +4 -0
  87. data/spec/unit/pops/types/p_timespan_type_spec.rb +14 -0
  88. data/spec/unit/pops/types/p_timestamp_type_spec.rb +19 -1
  89. data/spec/unit/pops/types/p_type_set_type_spec.rb +2 -2
  90. data/spec/unit/pops/types/ruby_generator_spec.rb +9 -22
  91. data/spec/unit/pops/types/string_converter_spec.rb +2 -2
  92. data/spec/unit/pops/types/type_acceptor_spec.rb +2 -2
  93. data/spec/unit/pops/types/type_calculator_spec.rb +43 -38
  94. data/spec/unit/pops/types/type_factory_spec.rb +6 -6
  95. data/spec/unit/pops/types/type_formatter_spec.rb +6 -6
  96. data/spec/unit/pops/types/types_spec.rb +16 -4
  97. data/spec/unit/provider/package/gem_spec.rb +6 -6
  98. data/spec/unit/provider/package/pip_spec.rb +44 -23
  99. data/spec/unit/provider/package/puppet_gem_spec.rb +1 -1
  100. data/spec/unit/provider/package/yum_spec.rb +8 -0
  101. data/spec/unit/resource/capability_finder_spec.rb +4 -5
  102. data/spec/unit/type/file_spec.rb +19 -14
  103. data/spec/unit/util/execution_spec.rb +216 -82
  104. data/tasks/generate_ast_model.rake +10 -2
  105. metadata +15 -2
@@ -12,6 +12,11 @@ describe 'Timestamp type' do
12
12
  expect(t).to eql(TypeFactory.timestamp('2015-03-01', '2016-12-24'))
13
13
  end
14
14
 
15
+ it 'DateTime#_strptime creates hash with :leftover field' do
16
+ expect(DateTime._strptime('2015-05-04 and bogus', '%F')).to include(:leftover)
17
+ expect(DateTime._strptime('2015-05-04T10:34:11.003 UTC and bogus', '%FT%T.%N %Z')).to include(:leftover)
18
+ end
19
+
15
20
  context 'when used in Puppet expressions' do
16
21
  include PuppetSpec::Compiler
17
22
  it 'is equal to itself only' do
@@ -25,6 +30,20 @@ describe 'Timestamp type' do
25
30
  expect(eval_and_collect_notices(code)).to eq(%w(true true false false))
26
31
  end
27
32
 
33
+ it 'does not consider an Integer to be an instance' do
34
+ code = <<-CODE
35
+ notice(assert_type(Timestamp, 1234))
36
+ CODE
37
+ expect { eval_and_collect_notices(code) }.to raise_error(/expects a Timestamp value, got Integer/)
38
+ end
39
+
40
+ it 'does not consider a Float to be an instance' do
41
+ code = <<-CODE
42
+ notice(assert_type(Timestamp, 1.234))
43
+ CODE
44
+ expect { eval_and_collect_notices(code) }.to raise_error(/expects a Timestamp value, got Float/)
45
+ end
46
+
28
47
  context "when parameterized" do
29
48
  it 'is equal other types with the same parameterization' do
30
49
  code = <<-CODE
@@ -82,7 +101,6 @@ describe 'Timestamp type' do
82
101
  end
83
102
 
84
103
  it 'should error when only part of the string is parsed' do
85
- pending("Requires full rewrite of Timestamp parse since there's no way to detect trailing garbage using DateTime#strptime")
86
104
  code = <<-CODE
87
105
  notice(Timestamp('2015-03-01T11:12:13 bogus after'))
88
106
  CODE
@@ -14,8 +14,8 @@ module Puppet::Pops
14
14
  let(:loader) { loaders.find_loader(nil) }
15
15
 
16
16
  def type_set_t(name, body_string, name_authority)
17
- i12n_literal_hash = pp_parser.parse_string("{#{body_string}}").body
18
- typeset = PTypeSetType.new(name, i12n_literal_hash, name_authority)
17
+ init_literal_hash = pp_parser.parse_string("{#{body_string}}").body
18
+ typeset = PTypeSetType.new(name, init_literal_hash, name_authority)
19
19
  loader.set_entry(Loader::TypedName.new(:type, name, name_authority), typeset)
20
20
  typeset
21
21
  end
@@ -379,28 +379,15 @@ describe 'Puppet Ruby Generator' do
379
379
 
380
380
  context 'the typeset' do
381
381
  it 'produces expected string representation' do
382
- typeset.to_s == "TypeSet[{"+
383
- "pcore_version => '1.0.0', "+
384
- "name_authority => 'http://puppet.com/2016.1/runtime', "+
385
- "name => 'OtherModule', "+
386
- "version => '1.0.0', "+
387
- "types => {"+
388
- "MyFloat => Float, "+
389
- "ThirdGenerated => Object[{"+
390
- "attributes => {"+
391
- "'first' => MyModule::FirstGenerated}}], "+
392
- "FourthGenerated => Object[{"+
393
- "parent => MyModule::SecondGenerated, "+
394
- "attributes => {"+
395
- "'complex' => {"+
396
- "type => Optional[ThirdGenerated], "+
397
- "value => ?}, "+
398
- "'n1' => MyModule::MyInteger, "+
399
- "'n2' => MyFloat}}]}, "+
400
- "references => [{"+
401
- "'name' => 'MyModule', "+
402
- "'alias' => 'My', "+
403
- "'version_range' => '1.x'}]}]"
382
+ expect(typeset.to_s).to eq(
383
+ "TypeSet[{pcore_version => '1.0.0', name_authority => 'http://puppet.com/2016.1/runtime', name => 'OtherModule', version => '1.0.0', types => {"+
384
+ "MyFloat => Float, "+
385
+ "ThirdGenerated => Object[{attributes => {'first' => My::FirstGenerated}}], "+
386
+ "FourthGenerated => Object[{parent => My::SecondGenerated, attributes => {"+
387
+ "'complex' => {type => Optional[ThirdGenerated], value => ?}, "+
388
+ "'n1' => My::MyInteger, "+
389
+ "'n2' => MyFloat"+
390
+ "}}]}, references => {My => {'name' => 'MyModule', 'version_range' => '1.x'}}}]")
404
391
  end
405
392
  end
406
393
 
@@ -1109,14 +1109,14 @@ describe 'The string converter' do
1109
1109
  "%#p" => 'Integer',
1110
1110
  }.each do |fmt, result |
1111
1111
  it "the format #{fmt} produces #{result}" do
1112
- string_formats = { Puppet::Pops::Types::PType::DEFAULT => fmt}
1112
+ string_formats = { Puppet::Pops::Types::PTypeType::DEFAULT => fmt}
1113
1113
  expect(converter.convert(factory.integer, string_formats)).to eq(result)
1114
1114
  end
1115
1115
  end
1116
1116
 
1117
1117
  it 'errors when format is not recognized' do
1118
1118
  expect do
1119
- string_formats = { Puppet::Pops::Types::PType::DEFAULT => "%k"}
1119
+ string_formats = { Puppet::Pops::Types::PTypeType::DEFAULT => "%k"}
1120
1120
  converter.convert(factory.integer, string_formats)
1121
1121
  end.to raise_error(/Illegal format 'k' specified for value of Type type - expected one of the characters 'sp'/)
1122
1122
  end
@@ -35,13 +35,13 @@ describe 'the Puppet::Pops::Types::TypeAcceptor' do
35
35
  end
36
36
 
37
37
  it "should get a visit from the type of a Type that accepts it" do
38
- t = PType.new(PAnyType::DEFAULT)
38
+ t = PTypeType.new(PAnyType::DEFAULT)
39
39
  t.accept(acceptor, nil)
40
40
  expect(acceptor.visitors).to include(t, PAnyType::DEFAULT)
41
41
  end
42
42
 
43
43
  [
44
- PType,
44
+ PTypeType,
45
45
  PNotUndefType,
46
46
  PIterableType,
47
47
  PIteratorType,
@@ -188,11 +188,11 @@ describe 'The type calculator' do
188
188
  end
189
189
  end
190
190
 
191
- it 'Class Foo translates to PType[PRuntimeType[ruby, Foo]]' do
191
+ it 'Class Foo translates to PTypeType[PRuntimeType[ruby, Foo]]' do
192
192
  ::Foo = Class.new
193
193
  begin
194
194
  t = calculator.infer(::Foo)
195
- expect(t.class).to eq(PType)
195
+ expect(t.class).to eq(PTypeType)
196
196
  tt = t.type
197
197
  expect(tt.class).to eq(PRuntimeType)
198
198
  expect(tt.runtime).to eq(:ruby)
@@ -202,11 +202,11 @@ describe 'The type calculator' do
202
202
  end
203
203
  end
204
204
 
205
- it 'Module FooModule translates to PType[PRuntimeType[ruby, FooModule]]' do
205
+ it 'Module FooModule translates to PTypeType[PRuntimeType[ruby, FooModule]]' do
206
206
  ::FooModule = Module.new
207
207
  begin
208
208
  t = calculator.infer(::FooModule)
209
- expect(t.class).to eq(PType)
209
+ expect(t.class).to eq(PTypeType)
210
210
  tt = t.type
211
211
  expect(tt.class).to eq(PRuntimeType)
212
212
  expect(tt.runtime).to eq(:ruby)
@@ -563,17 +563,17 @@ describe 'The type calculator' do
563
563
  end
564
564
 
565
565
  it 'computes given hostclass type commonality' do
566
- r1 = PHostClassType.new('foo')
567
- r2 = PHostClassType.new('foo')
566
+ r1 = PClassType.new('foo')
567
+ r2 = PClassType.new('foo')
568
568
  expect(calculator.common_type(r1, r2).to_s).to eq('Class[foo]')
569
569
 
570
- r2 = PHostClassType.new('bar')
570
+ r2 = PClassType.new('bar')
571
571
  expect(calculator.common_type(r1, r2).to_s).to eq('Class')
572
572
 
573
- r2 = PHostClassType.new(nil)
573
+ r2 = PClassType.new(nil)
574
574
  expect(calculator.common_type(r1, r2).to_s).to eq('Class')
575
575
 
576
- r1 = PHostClassType.new(nil)
576
+ r1 = PClassType.new(nil)
577
577
  expect(calculator.common_type(r1, r2).to_s).to eq('Class')
578
578
  end
579
579
 
@@ -841,7 +841,7 @@ describe 'The type calculator' do
841
841
  # Add a non-empty variant
842
842
  all_instances << variant_t(PAnyType::DEFAULT, PUnitType::DEFAULT)
843
843
  # Add a type alias that doesn't resolve to 't'
844
- all_instances << type_alias_t('MyInt', 'Integer').resolve(TypeParser.singleton, nil)
844
+ all_instances << type_alias_t('MyInt', 'Integer').resolve(nil)
845
845
 
846
846
  all_instances.each { |i| expect(i).not_to be_assignable_to(t) }
847
847
  end
@@ -873,7 +873,7 @@ describe 'The type calculator' do
873
873
  end
874
874
 
875
875
  it 'Data is not assignable to any disjunct type' do
876
- tested_types = all_types - [PAnyType, POptionalType] - scalar_types
876
+ tested_types = all_types - [PAnyType, POptionalType, PInitType] - scalar_types
877
877
  tested_types.each {|t2| expect(data).not_to be_assignable_to(t2::DEFAULT) }
878
878
  end
879
879
  end
@@ -909,7 +909,7 @@ describe 'The type calculator' do
909
909
  end
910
910
 
911
911
  it 'Scalar is not assignable to any disjunct type' do
912
- tested_types = all_types - [PAnyType, POptionalType, PNotUndefType] - scalar_types
912
+ tested_types = all_types - [PAnyType, POptionalType, PInitType, PNotUndefType] - scalar_types
913
913
  t = PScalarType::DEFAULT
914
914
  tested_types.each {|t2| expect(t).not_to be_assignable_to(t2::DEFAULT) }
915
915
  end
@@ -931,6 +931,7 @@ describe 'The type calculator' do
931
931
  tested_types = all_types - [
932
932
  PAnyType,
933
933
  POptionalType,
934
+ PInitType,
934
935
  PNotUndefType,
935
936
  PScalarType,
936
937
  PScalarDataType,
@@ -1087,6 +1088,7 @@ describe 'The type calculator' do
1087
1088
  tested_types = all_types - [
1088
1089
  PAnyType,
1089
1090
  POptionalType,
1091
+ PInitType,
1090
1092
  PNotUndefType,
1091
1093
  PIterableType] - collection_types
1092
1094
  t = PTupleType::DEFAULT
@@ -1100,7 +1102,8 @@ describe 'The type calculator' do
1100
1102
  tested_types = collection_types - [
1101
1103
  PCollectionType,
1102
1104
  PStructType,
1103
- PHashType]
1105
+ PHashType,
1106
+ PInitType]
1104
1107
  tested_types.each {|t2| expect(t).not_to be_assignable_to(t2::DEFAULT) }
1105
1108
  end
1106
1109
 
@@ -1109,7 +1112,8 @@ describe 'The type calculator' do
1109
1112
  PAnyType,
1110
1113
  POptionalType,
1111
1114
  PNotUndefType,
1112
- PIterableType] - collection_types
1115
+ PIterableType,
1116
+ PInitType] - collection_types
1113
1117
  t = PStructType::DEFAULT
1114
1118
  tested_types.each {|t2| expect(t).not_to be_assignable_to(t2::DEFAULT) }
1115
1119
  end
@@ -1585,12 +1589,12 @@ describe 'The type calculator' do
1585
1589
  let!(:parser) { TypeParser.singleton }
1586
1590
 
1587
1591
  it 'it is assignable to the type that it is an alias for' do
1588
- t = type_alias_t('Alias', 'Integer').resolve(parser, nil)
1592
+ t = type_alias_t('Alias', 'Integer').resolve(nil)
1589
1593
  expect(calculator.assignable?(integer_t, t)).to be_truthy
1590
1594
  end
1591
1595
 
1592
1596
  it 'the type that it is an alias for is assignable to it' do
1593
- t = type_alias_t('Alias', 'Integer').resolve(parser, nil)
1597
+ t = type_alias_t('Alias', 'Integer').resolve(nil)
1594
1598
  expect(calculator.assignable?(t, integer_t)).to be_truthy
1595
1599
  end
1596
1600
 
@@ -1603,7 +1607,7 @@ describe 'The type calculator' do
1603
1607
 
1604
1608
  Adapters::LoaderAdapter.expects(:loader_for_model_object).at_least_once.returns loader
1605
1609
 
1606
- t.resolve(parser, scope)
1610
+ t.resolve(scope)
1607
1611
  expect(calculator.assignable?(t, parser.parse('Hash[String,Variant[String,Hash[String,Variant[String,String]]]]'))).to be_truthy
1608
1612
  end
1609
1613
 
@@ -1619,8 +1623,8 @@ describe 'The type calculator' do
1619
1623
 
1620
1624
  Adapters::LoaderAdapter.expects(:loader_for_model_object).at_least_once.returns loader
1621
1625
 
1622
- t1.resolve(parser, scope)
1623
- t2.resolve(parser, scope)
1626
+ t1.resolve(scope)
1627
+ t2.resolve(scope)
1624
1628
  expect(calculator.assignable?(t1, t2)).to be_truthy
1625
1629
  end
1626
1630
 
@@ -1633,8 +1637,8 @@ describe 'The type calculator' do
1633
1637
 
1634
1638
  Adapters::LoaderAdapter.expects(:loader_for_model_object).at_least_once.returns loader
1635
1639
 
1636
- t1.resolve(parser, loader)
1637
- t2.resolve(parser, loader)
1640
+ t1.resolve(loader)
1641
+ t2.resolve(loader)
1638
1642
  expect(calculator.assignable?(t1, t2)).to be_truthy
1639
1643
  end
1640
1644
 
@@ -1723,11 +1727,12 @@ describe 'The type calculator' do
1723
1727
  expect(calculator.instance?(POptionalType::DEFAULT, :undef)).to eq(true)
1724
1728
  end
1725
1729
 
1726
- it 'should not consider undef to be an instance of any other type than Any, UndefType and Data' do
1730
+ it 'should not consider undef to be an instance of any other type than Any, Undef, Optional, and Init' do
1727
1731
  types_to_test = all_types - [
1728
1732
  PAnyType,
1729
1733
  PUndefType,
1730
1734
  POptionalType,
1735
+ PInitType
1731
1736
  ]
1732
1737
 
1733
1738
  types_to_test.each {|t| expect(calculator.instance?(t::DEFAULT, nil)).to eq(false) }
@@ -1969,12 +1974,12 @@ describe 'The type calculator' do
1969
1974
  let!(:parser) { TypeParser.singleton }
1970
1975
 
1971
1976
  it 'should consider x an instance of the aliased simple type' do
1972
- t = type_alias_t('Alias', 'Integer').resolve(parser, nil)
1977
+ t = type_alias_t('Alias', 'Integer').resolve(nil)
1973
1978
  expect(calculator.instance?(t, 15)).to be_truthy
1974
1979
  end
1975
1980
 
1976
1981
  it 'should consider x an instance of the aliased parameterized type' do
1977
- t = type_alias_t('Alias', 'Integer[0,20]').resolve(parser, nil)
1982
+ t = type_alias_t('Alias', 'Integer[0,20]').resolve(nil)
1978
1983
  expect(calculator.instance?(t, 15)).to be_truthy
1979
1984
  end
1980
1985
 
@@ -1985,7 +1990,7 @@ describe 'The type calculator' do
1985
1990
 
1986
1991
  Adapters::LoaderAdapter.expects(:loader_for_model_object).at_least_once.returns loader
1987
1992
 
1988
- t.resolve(parser, loader)
1993
+ t.resolve(loader)
1989
1994
  expect(calculator.instance?(t, {'a'=>{'aa'=>{'aaa'=>'aaaa'}}, 'b'=>'bb'})).to be_truthy
1990
1995
  end
1991
1996
 
@@ -1998,7 +2003,7 @@ describe 'The type calculator' do
1998
2003
 
1999
2004
  Adapters::LoaderAdapter.expects(:loader_for_model_object).at_least_once.returns loader
2000
2005
 
2001
- t1.resolve(parser, loader)
2006
+ t1.resolve(loader)
2002
2007
  expect(calculator.instance?(t1, {'a'=>{'aa'=>{'aaa'=>'aaaa'}}, 'b'=>'bb'})).to be_truthy
2003
2008
  end
2004
2009
  end
@@ -2054,8 +2059,8 @@ describe 'The type calculator' do
2054
2059
  end
2055
2060
 
2056
2061
  context 'when processing meta type' do
2057
- it 'should infer PType as the type of all other types' do
2058
- ptype = PType
2062
+ it 'should infer PTypeType as the type of all other types' do
2063
+ ptype = PTypeType
2059
2064
  expect(calculator.infer(PUndefType::DEFAULT ).is_a?(ptype)).to eq(true)
2060
2065
  expect(calculator.infer(PScalarType::DEFAULT ).is_a?(ptype)).to eq(true)
2061
2066
  expect(calculator.infer(PScalarDataType::DEFAULT).is_a?(ptype)).to eq(true)
@@ -2070,7 +2075,7 @@ describe 'The type calculator' do
2070
2075
  expect(calculator.infer(PHashType::DEFAULT ).is_a?(ptype)).to eq(true)
2071
2076
  expect(calculator.infer(PIterableType::DEFAULT ).is_a?(ptype)).to eq(true)
2072
2077
  expect(calculator.infer(PRuntimeType::DEFAULT ).is_a?(ptype)).to eq(true)
2073
- expect(calculator.infer(PHostClassType::DEFAULT ).is_a?(ptype)).to eq(true)
2078
+ expect(calculator.infer(PClassType::DEFAULT ).is_a?(ptype)).to eq(true)
2074
2079
  expect(calculator.infer(PResourceType::DEFAULT ).is_a?(ptype)).to eq(true)
2075
2080
  expect(calculator.infer(PEnumType::DEFAULT ).is_a?(ptype)).to eq(true)
2076
2081
  expect(calculator.infer(PPatternType::DEFAULT ).is_a?(ptype)).to eq(true)
@@ -2080,7 +2085,7 @@ describe 'The type calculator' do
2080
2085
  expect(calculator.infer(PCallableType::DEFAULT ).is_a?(ptype)).to eq(true)
2081
2086
  end
2082
2087
 
2083
- it 'should infer PType as the type of all other types' do
2088
+ it 'should infer PTypeType as the type of all other types' do
2084
2089
  expect(calculator.infer(PUndefType::DEFAULT ).to_s).to eq('Type[Undef]')
2085
2090
  expect(calculator.infer(PScalarType::DEFAULT ).to_s).to eq('Type[Scalar]')
2086
2091
  expect(calculator.infer(PScalarDataType::DEFAULT).to_s).to eq('Type[ScalarData]')
@@ -2094,8 +2099,8 @@ describe 'The type calculator' do
2094
2099
  expect(calculator.infer(PArrayType::DEFAULT ).to_s).to eq('Type[Array]')
2095
2100
  expect(calculator.infer(PHashType::DEFAULT ).to_s).to eq('Type[Hash]')
2096
2101
  expect(calculator.infer(PIterableType::DEFAULT ).to_s).to eq('Type[Iterable]')
2097
- expect(calculator.infer(PRuntimeType::DEFAULT ).to_s).to eq('Type[Runtime[?, ?]]')
2098
- expect(calculator.infer(PHostClassType::DEFAULT ).to_s).to eq('Type[Class]')
2102
+ expect(calculator.infer(PRuntimeType::DEFAULT ).to_s).to eq('Type[Runtime]')
2103
+ expect(calculator.infer(PClassType::DEFAULT ).to_s).to eq('Type[Class]')
2099
2104
  expect(calculator.infer(PResourceType::DEFAULT ).to_s).to eq('Type[Resource]')
2100
2105
  expect(calculator.infer(PEnumType::DEFAULT ).to_s).to eq('Type[Enum]')
2101
2106
  expect(calculator.infer(PVariantType::DEFAULT ).to_s).to eq('Type[Variant]')
@@ -2109,23 +2114,23 @@ describe 'The type calculator' do
2109
2114
  expect(calculator.infer(PResourceType.new('Foo::Fee::Fum')).to_s).to eq('Type[Foo::Fee::Fum]')
2110
2115
  end
2111
2116
 
2112
- it "computes the common type of PType's type parameter" do
2117
+ it "computes the common type of PTypeType's type parameter" do
2113
2118
  int_t = PIntegerType::DEFAULT
2114
2119
  string_t = PStringType::DEFAULT
2115
2120
  expect(calculator.infer([int_t]).to_s).to eq('Array[Type[Integer], 1, 1]')
2116
2121
  expect(calculator.infer([int_t, string_t]).to_s).to eq('Array[Type[ScalarData], 2, 2]')
2117
2122
  end
2118
2123
 
2119
- it 'should infer PType as the type of ruby classes' do
2124
+ it 'should infer PTypeType as the type of ruby classes' do
2120
2125
  class Foo
2121
2126
  end
2122
2127
  [Object, Numeric, Integer, Fixnum, Bignum, Float, String, Regexp, Array, Hash, Foo].each do |c|
2123
- expect(calculator.infer(c).is_a?(PType)).to eq(true)
2128
+ expect(calculator.infer(c).is_a?(PTypeType)).to eq(true)
2124
2129
  end
2125
2130
  end
2126
2131
 
2127
- it 'should infer PType as the type of PType (meta regression short-circuit)' do
2128
- expect(calculator.infer(PType::DEFAULT).is_a?(PType)).to eq(true)
2132
+ it 'should infer PTypeType as the type of PTypeType (meta regression short-circuit)' do
2133
+ expect(calculator.infer(PTypeType::DEFAULT).is_a?(PTypeType)).to eq(true)
2129
2134
  end
2130
2135
 
2131
2136
  it 'computes instance? to be true if parameterized and type match' do
@@ -2148,7 +2153,7 @@ describe 'The type calculator' do
2148
2153
  it 'computes instance? to be true if unparameterized and matched against a type[?]' do
2149
2154
  int_t = PIntegerType::DEFAULT
2150
2155
  type_t = TypeFactory.type_type(int_t)
2151
- expect(calculator.instance?(PType::DEFAULT, type_t)).to eq(true)
2156
+ expect(calculator.instance?(PTypeType::DEFAULT, type_t)).to eq(true)
2152
2157
  end
2153
2158
  end
2154
2159
 
@@ -133,21 +133,21 @@ describe 'The type factory' do
133
133
  expect(pr.type_name).to eq('X')
134
134
  end
135
135
 
136
- it 'host_class() creates a generic PHostClassType' do
136
+ it 'host_class() creates a generic PClassType' do
137
137
  hc = TypeFactory.host_class()
138
- expect(hc.class()).to eq(PHostClassType)
138
+ expect(hc.class()).to eq(PClassType)
139
139
  expect(hc.class_name).to eq(nil)
140
140
  end
141
141
 
142
- it 'host_class(x) creates a PHostClassType[x]' do
142
+ it 'host_class(x) creates a PClassType[x]' do
143
143
  hc = TypeFactory.host_class('x')
144
- expect(hc.class()).to eq(PHostClassType)
144
+ expect(hc.class()).to eq(PClassType)
145
145
  expect(hc.class_name).to eq('x')
146
146
  end
147
147
 
148
- it 'host_class(::x) creates a PHostClassType[x]' do
148
+ it 'host_class(::x) creates a PClassType[x]' do
149
149
  hc = TypeFactory.host_class('::x')
150
- expect(hc.class()).to eq(PHostClassType)
150
+ expect(hc.class()).to eq(PClassType)
151
151
  expect(hc.class_name).to eq('x')
152
152
  end
153
153
 
@@ -83,7 +83,7 @@ FORMATTED
83
83
  context 'when representing the type as string' do
84
84
  include_context 'types_setup'
85
85
 
86
- it "should yield 'Type' for PType" do
86
+ it "should yield 'Type' for PTypeType" do
87
87
  expect(s.string(f.type_type)).to eq('Type')
88
88
  end
89
89
 
@@ -265,11 +265,11 @@ FORMATTED
265
265
  expect(s.string(f.hash_of_any)).to eq('Hash')
266
266
  end
267
267
 
268
- it "should yield 'Class' for a PHostClassType" do
268
+ it "should yield 'Class' for a PClassType" do
269
269
  expect(s.string(f.host_class)).to eq('Class')
270
270
  end
271
271
 
272
- it "should yield 'Class[x]' for a PHostClassType[x]" do
272
+ it "should yield 'Class[x]' for a PClassType[x]" do
273
273
  expect(s.string(f.host_class('x'))).to eq('Class[x]')
274
274
  end
275
275
 
@@ -397,12 +397,12 @@ FORMATTED
397
397
  end
398
398
 
399
399
  it 'should present a valid simple name' do
400
- (all_types - [PType, PHostClassType]).each do |t|
400
+ (all_types - [PTypeType, PClassType]).each do |t|
401
401
  name = t::DEFAULT.simple_name
402
402
  expect(t.name).to match("^Puppet::Pops::Types::P#{name}Type$")
403
403
  end
404
- expect(PType::DEFAULT.simple_name).to eql('Type')
405
- expect(PHostClassType::DEFAULT.simple_name).to eql('Class')
404
+ expect(PTypeType::DEFAULT.simple_name).to eql('Type')
405
+ expect(PClassType::DEFAULT.simple_name).to eql('Class')
406
406
  end
407
407
  end
408
408
  end