puppet 3.2.4 → 3.3.0.rc2
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.
- data/COMMITTERS.md +101 -42
- data/Gemfile +15 -4
- data/README.md +5 -1
- data/README_DEVELOPER.md +117 -54
- data/Rakefile +4 -0
- data/ext/build_defaults.yaml +3 -2
- data/ext/debian/puppet-common.manpages +33 -1
- data/ext/gentoo/init.d/puppet +1 -1
- data/ext/gentoo/init.d/puppetmaster +1 -1
- data/ext/redhat/puppet.spec.erb +0 -1
- data/install.rb +2 -1
- data/lib/hiera/backend/puppet_backend.rb +1 -1
- data/lib/puppet/application.rb +10 -9
- data/lib/puppet/application/agent.rb +87 -93
- data/lib/puppet/application/apply.rb +0 -2
- data/lib/puppet/application/device.rb +3 -3
- data/lib/puppet/application/kick.rb +2 -2
- data/lib/puppet/application/master.rb +41 -19
- data/lib/puppet/application/queue.rb +5 -3
- data/lib/puppet/bindings.rb +147 -0
- data/lib/puppet/configurer.rb +25 -15
- data/lib/puppet/configurer/fact_handler.rb +2 -9
- data/lib/puppet/daemon.rb +44 -33
- data/lib/puppet/defaults.rb +57 -26
- data/lib/puppet/error.rb +1 -1
- data/lib/puppet/external/dot.rb +2 -2
- data/lib/puppet/external/nagios/base.rb +1 -6
- data/lib/puppet/external/pson/common.rb +2 -2
- data/lib/puppet/external/pson/pure/generator.rb +2 -2
- data/lib/puppet/external/pson/pure/parser.rb +1 -1
- data/lib/puppet/face/ca.rb +1 -1
- data/lib/puppet/face/config.rb +1 -1
- data/lib/puppet/face/help.rb +2 -2
- data/lib/puppet/face/module/list.rb +2 -2
- data/lib/puppet/feature/rails.rb +1 -1
- data/lib/puppet/file_bucket/dipper.rb +0 -1
- data/lib/puppet/file_serving/base.rb +1 -1
- data/lib/puppet/file_serving/configuration/parser.rb +20 -14
- data/lib/puppet/forge.rb +0 -32
- data/lib/puppet/forge/cache.rb +1 -1
- data/lib/puppet/forge/errors.rb +3 -3
- data/lib/puppet/forge/repository.rb +7 -42
- data/lib/puppet/graph.rb +11 -0
- data/lib/puppet/graph/key.rb +26 -0
- data/lib/puppet/graph/prioritizer.rb +29 -0
- data/lib/puppet/graph/random_prioritizer.rb +16 -0
- data/lib/puppet/{rb_tree_map.rb → graph/rb_tree_map.rb} +3 -3
- data/lib/puppet/graph/relationship_graph.rb +246 -0
- data/lib/puppet/graph/sequential_prioritizer.rb +31 -0
- data/lib/puppet/{simple_graph.rb → graph/simple_graph.rb} +22 -3
- data/lib/puppet/graph/title_hash_prioritizer.rb +16 -0
- data/lib/puppet/indirector.rb +2 -2
- data/lib/puppet/indirector/catalog/compiler.rb +10 -7
- data/lib/puppet/indirector/catalog/static_compiler.rb +50 -0
- data/lib/puppet/indirector/certificate/rest.rb +1 -1
- data/lib/puppet/indirector/exec.rb +1 -1
- data/lib/puppet/indirector/facts/facter.rb +2 -2
- data/lib/puppet/indirector/facts/inventory_active_record.rb +0 -1
- data/lib/puppet/indirector/facts/network_device.rb +1 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +0 -1
- data/lib/puppet/indirector/indirection.rb +2 -2
- data/lib/puppet/indirector/memory.rb +9 -0
- data/lib/puppet/indirector/node/ldap.rb +2 -4
- data/lib/puppet/indirector/report/processor.rb +1 -2
- data/lib/puppet/indirector/report/rest.rb +1 -1
- data/lib/puppet/indirector/request.rb +32 -10
- data/lib/puppet/indirector/resource/rest.rb +1 -1
- data/lib/puppet/indirector/resource_type/parser.rb +31 -12
- data/lib/puppet/interface.rb +1 -1
- data/lib/puppet/interface/documentation.rb +7 -11
- data/lib/puppet/interface/option.rb +1 -1
- data/lib/puppet/interface/option_builder.rb +1 -1
- data/lib/puppet/metatype/manager.rb +2 -2
- data/lib/puppet/module.rb +7 -1
- data/lib/puppet/module_tool.rb +1 -1
- data/lib/puppet/module_tool/applications/application.rb +10 -0
- data/lib/puppet/module_tool/applications/installer.rb +6 -3
- data/lib/puppet/module_tool/dependency.rb +2 -0
- data/lib/puppet/module_tool/errors/upgrader.rb +1 -1
- data/lib/puppet/module_tool/metadata.rb +25 -13
- data/lib/puppet/module_tool/modulefile.rb +7 -7
- data/lib/puppet/module_tool/shared_behaviors.rb +4 -2
- data/lib/puppet/module_tool/skeleton.rb +1 -1
- data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +5 -5
- data/lib/puppet/module_tool/skeleton/templates/generator/tests/init.pp.erb +5 -4
- data/lib/puppet/network/auth_config_parser.rb +3 -0
- data/lib/puppet/network/authconfig.rb +0 -1
- data/lib/puppet/network/authorization.rb +1 -1
- data/lib/puppet/network/authstore.rb +2 -2
- data/lib/puppet/network/format_handler.rb +25 -114
- data/lib/puppet/network/format_support.rb +106 -0
- data/lib/puppet/network/formats.rb +10 -4
- data/lib/puppet/network/http/compression.rb +1 -1
- data/lib/puppet/network/http/connection.rb +76 -32
- data/lib/puppet/network/http/handler.rb +122 -61
- data/lib/puppet/network/http/rack/rest.rb +1 -1
- data/lib/puppet/network/http/webrick/rest.rb +9 -3
- data/lib/puppet/network/http_pool.rb +2 -2
- data/lib/puppet/network/resolver.rb +1 -0
- data/lib/puppet/network/server.rb +5 -81
- data/lib/puppet/node/environment.rb +256 -13
- data/lib/puppet/node/facts.rb +28 -2
- data/lib/puppet/parameter.rb +27 -18
- data/lib/puppet/parameter/boolean.rb +20 -0
- data/lib/puppet/parameter/path.rb +1 -1
- data/lib/puppet/parameter/value.rb +1 -1
- data/lib/puppet/parameter/value_collection.rb +1 -1
- data/lib/puppet/parser/ast/arithmetic_operator.rb +8 -0
- data/lib/puppet/parser/ast/casestatement.rb +0 -3
- data/lib/puppet/parser/ast/lambda.rb +25 -6
- data/lib/puppet/parser/ast/leaf.rb +10 -3
- data/lib/puppet/parser/ast/nop.rb +1 -1
- data/lib/puppet/parser/ast/resource_override.rb +0 -2
- data/lib/puppet/parser/compiler.rb +92 -34
- data/lib/puppet/parser/files.rb +0 -5
- data/lib/puppet/parser/functions/create_resources.rb +23 -46
- data/lib/puppet/parser/functions/each.rb +0 -2
- data/lib/puppet/parser/functions/extlookup.rb +2 -2
- data/lib/puppet/parser/functions/foreach.rb +0 -2
- data/lib/puppet/parser/functions/hiera_include.rb +1 -1
- data/lib/puppet/parser/functions/lookup.rb +44 -0
- data/lib/puppet/parser/functions/slice.rb +1 -1
- data/lib/puppet/parser/grammar.ra +0 -1
- data/lib/puppet/parser/lexer.rb +0 -1
- data/lib/puppet/parser/parser.rb +0 -1
- data/lib/puppet/parser/parser_factory.rb +3 -2
- data/lib/puppet/parser/parser_support.rb +1 -1
- data/lib/puppet/parser/relationship.rb +1 -1
- data/lib/puppet/parser/scope.rb +49 -24
- data/lib/puppet/parser/type_loader.rb +13 -18
- data/lib/puppet/pops.rb +45 -0
- data/lib/puppet/pops/adaptable.rb +2 -2
- data/lib/puppet/pops/adapters.rb +4 -0
- data/lib/puppet/pops/binder/binder.rb +421 -0
- data/lib/puppet/pops/binder/binder_issues.rb +142 -0
- data/lib/puppet/pops/binder/bindings_checker.rb +217 -0
- data/lib/puppet/pops/binder/bindings_composer.rb +241 -0
- data/lib/puppet/pops/binder/bindings_factory.rb +847 -0
- data/lib/puppet/pops/binder/bindings_label_provider.rb +46 -0
- data/lib/puppet/pops/binder/bindings_loader.rb +79 -0
- data/lib/puppet/pops/binder/bindings_model.rb +215 -0
- data/lib/puppet/pops/binder/bindings_model_dumper.rb +205 -0
- data/lib/puppet/pops/binder/bindings_validator_factory.rb +28 -0
- data/lib/puppet/pops/binder/config/binder_config.rb +139 -0
- data/lib/puppet/pops/binder/config/binder_config_checker.rb +183 -0
- data/lib/puppet/pops/binder/config/diagnostic_producer.rb +32 -0
- data/lib/puppet/pops/binder/config/issues.rb +106 -0
- data/lib/puppet/pops/binder/hiera2.rb +10 -0
- data/lib/puppet/pops/binder/hiera2/bindings_provider.rb +148 -0
- data/lib/puppet/pops/binder/hiera2/config.rb +69 -0
- data/lib/puppet/pops/binder/hiera2/config_checker.rb +68 -0
- data/lib/puppet/pops/binder/hiera2/diagnostic_producer.rb +36 -0
- data/lib/puppet/pops/binder/hiera2/issues.rb +67 -0
- data/lib/puppet/pops/binder/hiera2/json_backend.rb +18 -0
- data/lib/puppet/pops/binder/hiera2/yaml_backend.rb +21 -0
- data/lib/puppet/pops/binder/injector.rb +688 -0
- data/lib/puppet/pops/binder/injector_entry.rb +53 -0
- data/lib/puppet/pops/binder/key_factory.rb +61 -0
- data/lib/puppet/pops/binder/producers.rb +829 -0
- data/lib/puppet/pops/binder/scheme_handler/confdir_hiera_scheme.rb +67 -0
- data/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb +34 -0
- data/lib/puppet/pops/binder/scheme_handler/module_hiera_scheme.rb +92 -0
- data/lib/puppet/pops/binder/scheme_handler/module_scheme.rb +84 -0
- data/lib/puppet/pops/binder/scheme_handler/symbolic_scheme.rb +54 -0
- data/lib/puppet/pops/binder/system_bindings.rb +72 -0
- data/lib/puppet/pops/issue_reporter.rb +75 -0
- data/lib/puppet/pops/issues.rb +9 -5
- data/lib/puppet/pops/model/ast_transformer.rb +4 -4
- data/lib/puppet/pops/model/ast_tree_dumper.rb +1 -1
- data/lib/puppet/pops/model/factory.rb +25 -13
- data/lib/puppet/pops/model/model.rb +1 -1
- data/lib/puppet/pops/model/tree_dumper.rb +2 -2
- data/lib/puppet/pops/parser/egrammar.ra +0 -1
- data/lib/puppet/pops/parser/eparser.rb +1 -2
- data/lib/puppet/pops/parser/evaluating_parser.rb +162 -0
- data/lib/puppet/pops/parser/lexer.rb +8 -6
- data/lib/puppet/pops/types/class_loader.rb +118 -0
- data/lib/puppet/pops/types/type_calculator.rb +557 -0
- data/lib/puppet/pops/types/type_factory.rb +147 -0
- data/lib/puppet/pops/types/type_parser.rb +117 -0
- data/lib/puppet/pops/types/types.rb +132 -0
- data/lib/puppet/pops/validation.rb +146 -17
- data/lib/puppet/pops/validation/checker3_1.rb +1 -1
- data/lib/puppet/pops/validation/validator_factory_3_1.rb +6 -16
- data/lib/puppet/property.rb +3 -3
- data/lib/puppet/property/keyvalue.rb +1 -1
- data/lib/puppet/provider.rb +2 -2
- data/lib/puppet/provider/aixobject.rb +19 -21
- data/lib/puppet/provider/augeas/augeas.rb +3 -1
- data/lib/puppet/provider/command.rb +2 -2
- data/lib/puppet/provider/group/aix.rb +1 -1
- data/lib/puppet/provider/group/ldap.rb +1 -1
- data/lib/puppet/provider/macauthorization/macauthorization.rb +1 -1
- data/lib/puppet/provider/mailalias/aliases.rb +3 -8
- data/lib/puppet/provider/mcx/mcxcontent.rb +7 -1
- data/lib/puppet/provider/mount.rb +8 -3
- data/lib/puppet/provider/nameservice.rb +1 -1
- data/lib/puppet/provider/nameservice/directoryservice.rb +5 -5
- data/lib/puppet/provider/package/appdmg.rb +1 -1
- data/lib/puppet/provider/package/apt.rb +0 -1
- data/lib/puppet/provider/package/dpkg.rb +86 -32
- data/lib/puppet/provider/package/fink.rb +0 -2
- data/lib/puppet/provider/package/freebsd.rb +0 -2
- data/lib/puppet/provider/package/openbsd.rb +57 -10
- data/lib/puppet/provider/package/opkg.rb +0 -1
- data/lib/puppet/provider/package/pacman.rb +0 -1
- data/lib/puppet/provider/package/pip.rb +1 -1
- data/lib/puppet/provider/package/pkgdmg.rb +17 -6
- data/lib/puppet/provider/package/pkgutil.rb +1 -1
- data/lib/puppet/provider/package/portage.rb +9 -1
- data/lib/puppet/provider/package/ports.rb +2 -2
- data/lib/puppet/provider/package/rpm.rb +29 -12
- data/lib/puppet/provider/package/rug.rb +1 -1
- data/lib/puppet/provider/package/urpmi.rb +11 -15
- data/lib/puppet/provider/package/windows/exe_package.rb +1 -1
- data/lib/puppet/provider/package/windows/package.rb +1 -26
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/package/zypper.rb +22 -3
- data/lib/puppet/provider/parsedfile.rb +1 -12
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +1 -1
- data/lib/puppet/provider/service/base.rb +1 -1
- data/lib/puppet/provider/service/daemontools.rb +3 -3
- data/lib/puppet/provider/service/debian.rb +1 -1
- data/lib/puppet/provider/service/init.rb +14 -20
- data/lib/puppet/provider/service/openrc.rb +3 -1
- data/lib/puppet/provider/service/redhat.rb +5 -8
- data/lib/puppet/provider/service/runit.rb +3 -2
- data/lib/puppet/provider/service/systemd.rb +1 -1
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
- data/lib/puppet/provider/sshkey/parsed.rb +0 -2
- data/lib/puppet/provider/user/aix.rb +25 -12
- data/lib/puppet/provider/user/directoryservice.rb +4 -7
- data/lib/puppet/provider/user/ldap.rb +0 -1
- data/lib/puppet/provider/user/user_role_add.rb +2 -0
- data/lib/puppet/provider/user/useradd.rb +1 -1
- data/lib/puppet/provider/zone/solaris.rb +1 -2
- data/lib/puppet/reference/metaparameter.rb +1 -1
- data/lib/puppet/reference/type.rb +1 -1
- data/lib/puppet/reports/rrdgraph.rb +1 -1
- data/lib/puppet/reports/tagmail.rb +1 -1
- data/lib/puppet/resource.rb +16 -4
- data/lib/puppet/resource/catalog.rb +111 -173
- data/lib/puppet/resource/status.rb +42 -3
- data/lib/puppet/resource/type.rb +33 -46
- data/lib/puppet/resource/type_collection.rb +19 -15
- data/lib/puppet/run.rb +5 -1
- data/lib/puppet/scheduler/scheduler.rb +14 -15
- data/lib/puppet/settings.rb +78 -41
- data/lib/puppet/settings/boolean_setting.rb +0 -2
- data/lib/puppet/settings/config_file.rb +0 -2
- data/lib/puppet/settings/directory_setting.rb +0 -2
- data/lib/puppet/settings/duration_setting.rb +0 -2
- data/lib/puppet/settings/enum_setting.rb +16 -0
- data/lib/puppet/settings/file_setting.rb +0 -2
- data/lib/puppet/settings/path_setting.rb +0 -2
- data/lib/puppet/settings/string_setting.rb +0 -3
- data/lib/puppet/settings/terminus_setting.rb +0 -2
- data/lib/puppet/ssl/certificate_authority.rb +102 -9
- data/lib/puppet/test/test_helper.rb +1 -0
- data/lib/puppet/transaction.rb +130 -292
- data/lib/puppet/transaction/additional_resource_generator.rb +126 -0
- data/lib/puppet/transaction/event.rb +16 -1
- data/lib/puppet/transaction/report.rb +34 -14
- data/lib/puppet/transaction/resource_harness.rb +16 -19
- data/lib/puppet/type.rb +59 -53
- data/lib/puppet/type/component.rb +0 -2
- data/lib/puppet/type/cron.rb +13 -2
- data/lib/puppet/type/exec.rb +5 -7
- data/lib/puppet/type/file.rb +9 -32
- data/lib/puppet/type/file/content.rb +4 -1
- data/lib/puppet/type/file/ctime.rb +3 -1
- data/lib/puppet/type/file/ensure.rb +1 -1
- data/lib/puppet/type/file/mode.rb +0 -1
- data/lib/puppet/type/file/mtime.rb +2 -1
- data/lib/puppet/type/group.rb +7 -9
- data/lib/puppet/type/host.rb +1 -2
- data/lib/puppet/type/mcx.rb +0 -1
- data/lib/puppet/type/mount.rb +38 -6
- data/lib/puppet/type/package.rb +2 -2
- data/lib/puppet/type/resources.rb +5 -4
- data/lib/puppet/type/schedule.rb +1 -4
- data/lib/puppet/type/selmodule.rb +1 -1
- data/lib/puppet/type/service.rb +1 -3
- data/lib/puppet/type/tidy.rb +3 -3
- data/lib/puppet/type/user.rb +9 -13
- data/lib/puppet/type/yumrepo.rb +11 -7
- data/lib/puppet/util.rb +14 -7
- data/lib/puppet/util/autoload.rb +0 -1
- data/lib/puppet/util/backups.rb +1 -3
- data/lib/puppet/util/classgen.rb +1 -1
- data/lib/puppet/util/command_line/puppet_option_parser.rb +1 -3
- data/lib/puppet/util/command_line/trollop.rb +1 -1
- data/lib/puppet/util/constant_inflector.rb +1 -2
- data/lib/puppet/util/errors.rb +1 -0
- data/lib/puppet/util/file_watcher.rb +28 -0
- data/lib/puppet/util/fileparsing.rb +1 -3
- data/lib/puppet/util/filetype.rb +0 -1
- data/lib/puppet/util/http_proxy.rb +38 -0
- data/lib/puppet/util/ldap/manager.rb +1 -2
- data/lib/puppet/util/log.rb +31 -10
- data/lib/puppet/util/log/destinations.rb +0 -50
- data/lib/puppet/util/metric.rb +8 -1
- data/lib/puppet/util/monkey_patches.rb +14 -148
- data/lib/puppet/util/network_device/cisco/facts.rb +1 -1
- data/lib/puppet/util/network_device/config.rb +6 -9
- data/lib/puppet/util/network_device/transport/ssh.rb +1 -1
- data/lib/puppet/util/pidlock.rb +3 -0
- data/lib/puppet/util/posix.rb +1 -1
- data/lib/puppet/util/profiler.rb +1 -1
- data/lib/puppet/util/rdoc.rb +1 -1
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +0 -1
- data/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb +50 -42
- data/lib/puppet/util/retryaction.rb +0 -1
- data/lib/puppet/util/symbolic_file_mode.rb +5 -1
- data/lib/puppet/util/tagging.rb +0 -2
- data/lib/puppet/util/warnings.rb +3 -0
- data/lib/puppet/util/watched_file.rb +37 -0
- data/lib/puppet/util/watcher.rb +17 -0
- data/lib/puppet/util/watcher/change_watcher.rb +33 -0
- data/lib/puppet/util/watcher/periodic_watcher.rb +37 -0
- data/lib/puppet/util/watcher/timer.rb +19 -0
- data/lib/puppet/util/windows/user.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppetx.rb +109 -0
- data/lib/puppetx/puppet/bindings_scheme_handler.rb +130 -0
- data/lib/puppetx/puppet/hiera2_backend.rb +31 -0
- data/lib/puppetx/puppet/syntax_checker.rb +91 -0
- data/lib/puppetx/puppetlabs/syntax_checkers/json.rb +39 -0
- data/lib/semver.rb +1 -1
- data/man/man8/puppet-kick.8 +1 -1
- data/spec/fixtures/integration/provider/cron/crontab/unspecialized +15 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/binder_config.yaml +18 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/hiera.yaml +8 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/modules/good/common.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/modules/good/hiera.yaml +10 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/binder_config.yaml +19 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/common.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/hiera.yaml +11 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/localhost.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/common.yaml +3 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/hiera.yaml +13 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppet/bindings/awesome/default.rb +4 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppetx/awesome/echo_backend.rb +11 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppetx/awesome/echo_scheme_handler.rb +18 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/localhost.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/bad/common.yaml +3 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/bad/hiera_config.yaml +9 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/good/common.yaml +2 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/good/hiera.yaml +11 -0
- data/spec/fixtures/unit/pops/binder/config/binder_config/ok/binder_config.yaml +9 -0
- data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/hiera.yaml +9 -0
- data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/node.example.com.json +9 -0
- data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/node.example.com.yaml +5 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/bad_syntax/hiera.yaml +10 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/malformed_hierarchy/hiera.yaml +8 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/missing/foo.txt +1 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/no_backends/hiera.yaml +7 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/no_hierarchy/hiera.yaml +4 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/not_a_hash/hiera.yaml +2 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/ok/hiera.yaml +8 -0
- data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/empty/common.yaml +0 -0
- data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/invalid/common.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/ok/common.yaml +2 -0
- data/spec/fixtures/unit/provider/package/openbsd/pkginfo_flavors.list +2 -0
- data/spec/integration/agent/logging_spec.rb +178 -0
- data/spec/integration/configurer_spec.rb +1 -1
- data/spec/integration/defaults_spec.rb +0 -6
- data/spec/integration/network/authconfig_spec.rb +19 -0
- data/spec/integration/network/server/webrick_spec.rb +10 -11
- data/spec/integration/parser/catalog_spec.rb +85 -0
- data/spec/integration/provider/cron/crontab_spec.rb +11 -0
- data/spec/integration/provider/mount_spec.rb +1 -0
- data/spec/integration/transaction_spec.rb +8 -8
- data/spec/integration/type/file_spec.rb +1 -1
- data/spec/integration/util/settings_spec.rb +58 -11
- data/spec/lib/matchers/include_in_order.rb +21 -0
- data/spec/lib/matchers/include_in_order_spec.rb +30 -0
- data/spec/lib/matchers/relationship_graph_matchers.rb +48 -0
- data/spec/lib/puppet_spec/compiler.rb +24 -0
- data/spec/lib/puppet_spec/pops.rb +16 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/unit/application/agent_spec.rb +145 -145
- data/spec/unit/application/apply_spec.rb +1 -1
- data/spec/unit/application/doc_spec.rb +1 -1
- data/spec/unit/application/face_base_spec.rb +3 -3
- data/spec/unit/application/facts_spec.rb +1 -0
- data/spec/unit/application/master_spec.rb +0 -15
- data/spec/unit/application/queue_spec.rb +6 -12
- data/spec/unit/application/resource_spec.rb +1 -1
- data/spec/unit/configurer/fact_handler_spec.rb +19 -50
- data/spec/unit/configurer_spec.rb +23 -7
- data/spec/unit/daemon_spec.rb +97 -121
- data/spec/unit/defaults_spec.rb +44 -0
- data/spec/unit/face/node_spec.rb +2 -2
- data/spec/unit/file_serving/configuration/parser_spec.rb +23 -33
- data/spec/unit/file_serving/configuration_spec.rb +2 -2
- data/spec/unit/file_serving/mount/file_spec.rb +4 -4
- data/spec/unit/forge/repository_spec.rb +9 -29
- data/spec/unit/graph/key_spec.rb +41 -0
- data/spec/unit/{rb_tree_map_spec.rb → graph/rb_tree_map_spec.rb} +7 -7
- data/spec/unit/graph/relationship_graph_spec.rb +393 -0
- data/spec/unit/graph/sequential_prioritizer_spec.rb +32 -0
- data/spec/unit/{simple_graph_spec.rb → graph/simple_graph.rb} +42 -254
- data/spec/unit/graph/title_hash_prioritizer_spec.rb +49 -0
- data/spec/unit/hiera_puppet_spec.rb +1 -1
- data/spec/unit/indirector/catalog/active_record_spec.rb +4 -2
- data/spec/unit/indirector/catalog/compiler_spec.rb +20 -26
- data/spec/unit/indirector/face_spec.rb +1 -1
- data/spec/unit/indirector/facts/facter_spec.rb +11 -1
- data/spec/unit/indirector/facts/network_device_spec.rb +11 -1
- data/spec/unit/indirector/hiera_spec.rb +1 -1
- data/spec/unit/indirector/instrumentation_data/local_spec.rb +1 -1
- data/spec/unit/indirector/instrumentation_listener/local_spec.rb +1 -1
- data/spec/unit/indirector/request_spec.rb +92 -39
- data/spec/unit/indirector/rest_spec.rb +1 -0
- data/spec/unit/indirector_spec.rb +2 -2
- data/spec/unit/interface/option_builder_spec.rb +1 -0
- data/spec/unit/interface/option_spec.rb +1 -0
- data/spec/unit/interface_spec.rb +2 -2
- data/spec/unit/module_tool/applications/installer_spec.rb +49 -2
- data/spec/unit/module_tool/metadata_spec.rb +13 -0
- data/spec/unit/network/authstore_spec.rb +1 -1
- data/spec/unit/network/format_handler_spec.rb +33 -282
- data/spec/unit/network/format_support_spec.rb +199 -0
- data/spec/unit/network/formats_spec.rb +2 -2
- data/spec/unit/network/http/connection_spec.rb +88 -7
- data/spec/unit/network/http/handler_spec.rb +271 -249
- data/spec/unit/network/http/rack/rest_spec.rb +1 -1
- data/spec/unit/network/http/webrick/rest_spec.rb +73 -22
- data/spec/unit/network/http_pool_spec.rb +40 -0
- data/spec/unit/network/server_spec.rb +18 -207
- data/spec/unit/node/facts_spec.rb +68 -17
- data/spec/unit/other/selinux_spec.rb +24 -20
- data/spec/unit/parameter/boolean_spec.rb +25 -0
- data/spec/unit/parameter/value_collection_spec.rb +7 -7
- data/spec/unit/parameter_spec.rb +10 -13
- data/spec/unit/parser/ast/function_spec.rb +4 -4
- data/spec/unit/parser/ast/leaf_spec.rb +45 -6
- data/spec/unit/parser/collector_spec.rb +3 -3
- data/spec/unit/parser/compiler_spec.rb +4 -3
- data/spec/unit/parser/functions/create_resources_spec.rb +9 -25
- data/spec/unit/parser/functions/extlookup_spec.rb +2 -2
- data/spec/unit/parser/functions/hiera_include_spec.rb +12 -0
- data/spec/unit/parser/functions/lookup_spec.rb +96 -0
- data/spec/unit/parser/functions/regsubst_spec.rb +2 -2
- data/spec/unit/parser/functions/split_spec.rb +2 -2
- data/spec/unit/parser/functions/sprintf_spec.rb +1 -1
- data/spec/unit/parser/functions/versioncmp_spec.rb +2 -2
- data/spec/unit/parser/functions_spec.rb +7 -7
- data/spec/unit/parser/lexer_spec.rb +1 -1
- data/spec/unit/parser/methods/collect_spec.rb +43 -0
- data/spec/unit/parser/resource_spec.rb +9 -9
- data/spec/unit/parser/scope_spec.rb +45 -2
- data/spec/unit/parser/type_loader_spec.rb +159 -175
- data/spec/unit/pops/binder/binder_spec.rb +62 -0
- data/spec/unit/pops/binder/bindings_checker_spec.rb +196 -0
- data/spec/unit/pops/binder/bindings_composer_spec.rb +89 -0
- data/spec/unit/pops/binder/bindings_validator_factory_spec.rb +18 -0
- data/spec/unit/pops/binder/config/binder_config_spec.rb +48 -0
- data/spec/unit/pops/binder/hiera2/bindings_provider_spec.rb +74 -0
- data/spec/unit/pops/binder/hiera2/config_spec.rb +61 -0
- data/spec/unit/pops/binder/hiera2/yaml_backend_spec.rb +33 -0
- data/spec/unit/pops/binder/injector_spec.rb +789 -0
- data/spec/unit/pops/containment_spec.rb +1 -0
- data/spec/unit/pops/issues_spec.rb +1 -1
- data/spec/unit/pops/parser/evaluating_parser_spec.rb +88 -0
- data/spec/unit/pops/parser/lexer_spec.rb +1 -1
- data/spec/unit/pops/parser/parse_calls_spec.rb +4 -0
- data/spec/unit/pops/parser/parser_spec.rb +1 -1
- data/spec/unit/pops/types/type_calculator_spec.rb +484 -0
- data/spec/unit/pops/types/type_factory_spec.rb +65 -0
- data/spec/unit/pops/types/type_parser_spec.rb +93 -0
- data/spec/unit/property/list_spec.rb +1 -1
- data/spec/unit/property/ordered_list_spec.rb +1 -1
- data/spec/unit/provider/aixobject_spec.rb +101 -0
- data/spec/unit/provider/augeas/augeas_spec.rb +14 -3
- data/spec/unit/provider/mcx/mcxcontent_spec.rb +52 -16
- data/spec/unit/provider/mount/parsed_spec.rb +44 -56
- data/spec/unit/provider/mount_spec.rb +11 -2
- data/spec/unit/provider/naginator_spec.rb +8 -0
- data/spec/unit/provider/package/apt_spec.rb +5 -1
- data/spec/unit/provider/package/aptitude_spec.rb +9 -5
- data/spec/unit/provider/package/aptrpm_spec.rb +2 -2
- data/spec/unit/provider/package/dpkg_spec.rb +274 -99
- data/spec/unit/provider/package/openbsd_spec.rb +84 -1
- data/spec/unit/provider/package/opkg_spec.rb +3 -3
- data/spec/unit/provider/package/pip_spec.rb +16 -0
- data/spec/unit/provider/package/pkgdmg_spec.rb +62 -7
- data/spec/unit/provider/package/rpm_spec.rb +112 -21
- data/spec/unit/provider/package/urpmi.rb +80 -0
- data/spec/unit/provider/package/windows/exe_package_spec.rb +1 -1
- data/spec/unit/provider/package/yum_spec.rb +85 -0
- data/spec/unit/provider/package/zypper_spec.rb +25 -6
- data/spec/unit/provider/parsedfile_spec.rb +3 -2
- data/spec/unit/provider/service/init_spec.rb +10 -10
- data/spec/unit/provider/service/openrc_spec.rb +16 -0
- data/spec/unit/provider/service/openwrt_spec.rb +1 -1
- data/spec/unit/provider/service/redhat_spec.rb +7 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +2 -2
- data/spec/unit/provider/user/aix_spec.rb +89 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +11 -4
- data/spec/unit/provider/user/user_role_add_spec.rb +18 -0
- data/spec/unit/provider_spec.rb +2 -13
- data/spec/unit/reports/http_spec.rb +1 -1
- data/spec/unit/resource/catalog_spec.rb +23 -97
- data/spec/unit/resource/resource_type.json +34 -0
- data/spec/unit/resource/status_spec.rb +56 -0
- data/spec/unit/resource/type_collection_spec.rb +6 -6
- data/spec/unit/resource/type_spec.rb +25 -5
- data/spec/unit/resource_spec.rb +68 -24
- data/spec/unit/run_spec.rb +16 -0
- data/spec/unit/scheduler/scheduler_spec.rb +14 -27
- data/spec/unit/semver_spec.rb +5 -0
- data/spec/unit/settings/enum_setting_spec.rb +27 -0
- data/spec/unit/settings_spec.rb +53 -44
- data/spec/unit/ssl/certificate_authority_spec.rb +155 -19
- data/spec/unit/transaction/additional_resource_generator_spec.rb +419 -0
- data/spec/unit/transaction/event_manager_spec.rb +2 -2
- data/spec/unit/transaction/event_spec.rb +57 -0
- data/spec/unit/transaction/report_spec.rb +66 -0
- data/spec/unit/transaction/resource_harness_spec.rb +27 -20
- data/spec/unit/transaction_spec.rb +182 -390
- data/spec/unit/type/augeas_spec.rb +3 -3
- data/spec/unit/type/component_spec.rb +0 -9
- data/spec/unit/type/computer_spec.rb +1 -1
- data/spec/unit/type/cron_spec.rb +2 -2
- data/spec/unit/type/exec_spec.rb +4 -2
- data/spec/unit/type/file/content_spec.rb +11 -0
- data/spec/unit/type/file/group_spec.rb +1 -1
- data/spec/unit/type/file_spec.rb +16 -8
- data/spec/unit/type/mount_spec.rb +445 -259
- data/spec/unit/type/package_spec.rb +4 -4
- data/spec/unit/type/resources_spec.rb +30 -1
- data/spec/unit/type/user_spec.rb +26 -3
- data/spec/unit/type/yumrepo_spec.rb +7 -27
- data/spec/unit/type/zone_spec.rb +4 -1
- data/spec/unit/type_spec.rb +66 -33
- data/spec/unit/util/backups_spec.rb +3 -3
- data/spec/unit/util/http_proxy_spec.rb +83 -0
- data/spec/unit/util/log_spec.rb +79 -8
- data/spec/unit/util/metric_spec.rb +12 -0
- data/spec/unit/util/monkey_patches_spec.rb +6 -0
- data/spec/unit/util/network_device/config_spec.rb +26 -64
- data/spec/unit/util/pidlock_spec.rb +4 -1
- data/spec/unit/util/tagging_spec.rb +5 -9
- data/spec/unit/util/warnings_spec.rb +1 -1
- data/spec/unit/util/watched_file_spec.rb +52 -0
- data/spec/unit/util/watcher/periodic_watcher_spec.rb +52 -0
- data/spec/unit/util/watcher_spec.rb +56 -0
- data/spec/unit/util_spec.rb +16 -0
- metadata +2767 -2576
- data/ext/debian/puppet.manpages +0 -32
- data/ext/osx/PackageInfo.plist +0 -36
- data/ext/osx/createpackage.sh +0 -187
- data/ext/redhat/rundir-perms.patch +0 -28
- data/lib/puppet/external/base64.rb +0 -19
- data/lib/puppet/util/graph.rb +0 -27
- data/lib/puppet/util/loadedfile.rb +0 -61
- data/lib/puppet/util/log_paths.rb +0 -22
- data/lib/puppet/util/subclass_loader.rb +0 -78
- data/spec/monkey_patches/publicize_methods.rb +0 -11
- data/spec/unit/util/loadedfile_spec.rb +0 -71
@@ -16,7 +16,7 @@ describe "Puppet::Pops::Issues" do
|
|
16
16
|
x.format(:name => 'Boo-Hoo',
|
17
17
|
:label => Puppet::Pops::Model::ModelLabelProvider.new,
|
18
18
|
:semantic => "dummy"
|
19
|
-
).should == "A Ruby String may not have a name
|
19
|
+
).should == "A Ruby String may not have a name containing a hyphen. The name 'Boo-Hoo' is not legal"
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should should format a message that does not require an argument" do
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'puppet/pops'
|
3
|
+
require 'puppet_spec/pops'
|
4
|
+
|
5
|
+
describe 'The hiera2 string evaluator' do
|
6
|
+
|
7
|
+
include PuppetSpec::Pops
|
8
|
+
|
9
|
+
let(:acceptor) { Puppet::Pops::Validation::Acceptor.new() }
|
10
|
+
let(:diag) { Puppet::Pops::Binder::Hiera2::DiagnosticProducer.new(acceptor) }
|
11
|
+
let(:scope) { s = Puppet::Parser::Scope.new_for_test_harness(node); s }
|
12
|
+
let(:node) { 'node.example.com' }
|
13
|
+
|
14
|
+
def quote(x)
|
15
|
+
Puppet::Pops::Parser::EvaluatingParser.quote(x)
|
16
|
+
end
|
17
|
+
|
18
|
+
def evaluator()
|
19
|
+
Puppet::Pops::Parser::EvaluatingParser.new()
|
20
|
+
end
|
21
|
+
|
22
|
+
def evaluate(s)
|
23
|
+
evaluator.evaluate(scope, quote(s))
|
24
|
+
end
|
25
|
+
|
26
|
+
def test(x)
|
27
|
+
evaluator.evaluate_string(scope, quote(x)).should == x
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_interpolate(x, y)
|
31
|
+
scope['a'] = 'expansion'
|
32
|
+
evaluator.evaluate_string(scope, quote(x)).should == y
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'when evaluating' do
|
36
|
+
it 'should produce an empty string with no change' do
|
37
|
+
test('')
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should produce a normal string with no change' do
|
41
|
+
test('A normal string')
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should produce a string with newlines with no change' do
|
45
|
+
test("A\nnormal\nstring")
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should produce a string with escaped newlines with no change' do
|
49
|
+
test("A\\nnormal\\nstring")
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should produce a string containing quotes without change' do
|
53
|
+
test('This " should remain untouched')
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should produce a string containing escaped quotes without change' do
|
57
|
+
test('This \" should remain untouched')
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should expand ${a} variables' do
|
61
|
+
test_interpolate('This ${a} was expanded', 'This expansion was expanded')
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should expand quoted ${a} variables' do
|
65
|
+
test_interpolate('This "${a}" was expanded', 'This "expansion" was expanded')
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should not expand escaped ${a}' do
|
69
|
+
test_interpolate('This \${a} was not expanded', 'This ${a} was not expanded')
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'should expand $a variables' do
|
73
|
+
test_interpolate('This $a was expanded', 'This expansion was expanded')
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should expand quoted $a variables' do
|
77
|
+
test_interpolate('This "$a" was expanded', 'This "expansion" was expanded')
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should not expand escaped $a' do
|
81
|
+
test_interpolate('This \$a was not expanded', 'This $a was not expanded')
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should produce an single space from a \s' do
|
85
|
+
test_interpolate("\\s", ' ')
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -763,7 +763,7 @@ describe "Puppet::Pops::Parser::Lexer in the old tests when lexing example files
|
|
763
763
|
end
|
764
764
|
end
|
765
765
|
|
766
|
-
describe "when trying to lex
|
766
|
+
describe "when trying to lex a non-existent file" do
|
767
767
|
include PuppetSpec::Files
|
768
768
|
|
769
769
|
it "should return an empty list of tokens" do
|
@@ -29,6 +29,10 @@ describe "egrammar parsing function calls" do
|
|
29
29
|
it "foo(bar, fum,)" do
|
30
30
|
dump(parse("foo(bar,fum,)")).should == "(invoke foo bar fum)"
|
31
31
|
end
|
32
|
+
|
33
|
+
it "foo fqdn_rand(30)" do
|
34
|
+
dump(parse("foo fqdn_rand(30)")).should == '(invoke foo (call fqdn_rand 30))'
|
35
|
+
end
|
32
36
|
end
|
33
37
|
|
34
38
|
context "in nested scopes" do
|
@@ -10,6 +10,6 @@ describe Puppet::Pops::Parser::Parser do
|
|
10
10
|
it "should parse a code string and return a model" do
|
11
11
|
parser = Puppet::Pops::Parser::Parser.new()
|
12
12
|
model = parser.parse_string("$a = 10").current
|
13
|
-
model.class.should == Model::AssignmentExpression
|
13
|
+
model.class.should == Puppet::Pops::Model::AssignmentExpression
|
14
14
|
end
|
15
15
|
end
|
@@ -0,0 +1,484 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'puppet/pops'
|
3
|
+
|
4
|
+
describe 'The type calculator' do
|
5
|
+
let(:calculator) { Puppet::Pops::Types::TypeCalculator.new() }
|
6
|
+
|
7
|
+
context 'when inferring ruby' do
|
8
|
+
|
9
|
+
it 'fixnum translates to PIntegerType' do
|
10
|
+
calculator.infer(1).class.should == Puppet::Pops::Types::PIntegerType
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'large fixnum (or bignum depending on architecture) translates to PIntegerType' do
|
14
|
+
calculator.infer(2**33).class.should == Puppet::Pops::Types::PIntegerType
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'float translates to PFloatType' do
|
18
|
+
calculator.infer(1.3).class.should == Puppet::Pops::Types::PFloatType
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'string translates to PStringType' do
|
22
|
+
calculator.infer('foo').class.should == Puppet::Pops::Types::PStringType
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'boolean true translates to PBooleanType' do
|
26
|
+
calculator.infer(true).class.should == Puppet::Pops::Types::PBooleanType
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'boolean false translates to PBooleanType' do
|
30
|
+
calculator.infer(false).class.should == Puppet::Pops::Types::PBooleanType
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'regexp translates to PPatternType' do
|
34
|
+
calculator.infer(/^a regular exception$/).class.should == Puppet::Pops::Types::PPatternType
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'nil translates to PNilType' do
|
38
|
+
calculator.infer(nil).class.should == Puppet::Pops::Types::PNilType
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'an instance of class Foo translates to PRubyType[Foo]' do
|
42
|
+
class Foo
|
43
|
+
end
|
44
|
+
|
45
|
+
t = calculator.infer(Foo.new)
|
46
|
+
t.class.should == Puppet::Pops::Types::PRubyType
|
47
|
+
t.ruby_class.should == 'Foo'
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'array' do
|
51
|
+
it 'translates to PArrayType' do
|
52
|
+
calculator.infer([1,2]).class.should == Puppet::Pops::Types::PArrayType
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'with fixnum values translates to PArrayType[PIntegerType]' do
|
56
|
+
calculator.infer([1,2]).element_type.class.should == Puppet::Pops::Types::PIntegerType
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'with 32 and 64 bit integer values translates to PArrayType[PIntegerType]' do
|
60
|
+
calculator.infer([1,2**33]).element_type.class.should == Puppet::Pops::Types::PIntegerType
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'with fixnum and float values translates to PArrayType[PNumericType]' do
|
64
|
+
calculator.infer([1,2.0]).element_type.class.should == Puppet::Pops::Types::PNumericType
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'with fixnum and string values translates to PArrayType[PLiteralType]' do
|
68
|
+
calculator.infer([1,'two']).element_type.class.should == Puppet::Pops::Types::PLiteralType
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'with float and string values translates to PArrayType[PLiteralType]' do
|
72
|
+
calculator.infer([1.0,'two']).element_type.class.should == Puppet::Pops::Types::PLiteralType
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'with fixnum, float, and string values translates to PArrayType[PLiteralType]' do
|
76
|
+
calculator.infer([1, 2.0,'two']).element_type.class.should == Puppet::Pops::Types::PLiteralType
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'with fixnum and regexp values translates to PArrayType[PLiteralType]' do
|
80
|
+
calculator.infer([1, /two/]).element_type.class.should == Puppet::Pops::Types::PLiteralType
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'with string and regexp values translates to PArrayType[PLiteralType]' do
|
84
|
+
calculator.infer(['one', /two/]).element_type.class.should == Puppet::Pops::Types::PLiteralType
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'with string and symbol values translates to PArrayType[PObjectType]' do
|
88
|
+
calculator.infer(['one', :two]).element_type.class.should == Puppet::Pops::Types::PObjectType
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'with fixnum and nil values translates to PArrayType[PIntegerType]' do
|
92
|
+
calculator.infer([1, nil]).element_type.class.should == Puppet::Pops::Types::PIntegerType
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'with arrays of string values translates to PArrayType[PArrayType[PStringType]]' do
|
96
|
+
et = calculator.infer([['first' 'array'], ['second','array']])
|
97
|
+
et.class.should == Puppet::Pops::Types::PArrayType
|
98
|
+
et = et.element_type
|
99
|
+
et.class.should == Puppet::Pops::Types::PArrayType
|
100
|
+
et = et.element_type
|
101
|
+
et.class.should == Puppet::Pops::Types::PStringType
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'with array of string values and array of fixnums translates to PArrayType[PArrayType[PLiteralType]]' do
|
105
|
+
et = calculator.infer([['first' 'array'], [1,2]])
|
106
|
+
et.class.should == Puppet::Pops::Types::PArrayType
|
107
|
+
et = et.element_type
|
108
|
+
et.class.should == Puppet::Pops::Types::PArrayType
|
109
|
+
et = et.element_type
|
110
|
+
et.class.should == Puppet::Pops::Types::PLiteralType
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'with hashes of string values translates to PArrayType[PHashType[PStringType]]' do
|
114
|
+
et = calculator.infer([{:first => 'first', :second => 'second' }, {:first => 'first', :second => 'second' }])
|
115
|
+
et.class.should == Puppet::Pops::Types::PArrayType
|
116
|
+
et = et.element_type
|
117
|
+
et.class.should == Puppet::Pops::Types::PHashType
|
118
|
+
et = et.element_type
|
119
|
+
et.class.should == Puppet::Pops::Types::PStringType
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'with hash of string values and hash of fixnums translates to PArrayType[PHashType[PLiteralType]]' do
|
123
|
+
et = calculator.infer([{:first => 'first', :second => 'second' }, {:first => 1, :second => 2 }])
|
124
|
+
et.class.should == Puppet::Pops::Types::PArrayType
|
125
|
+
et = et.element_type
|
126
|
+
et.class.should == Puppet::Pops::Types::PHashType
|
127
|
+
et = et.element_type
|
128
|
+
et.class.should == Puppet::Pops::Types::PLiteralType
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
context 'hash' do
|
133
|
+
it 'translates to PHashType' do
|
134
|
+
calculator.infer({:first => 1, :second => 2}).class.should == Puppet::Pops::Types::PHashType
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'with symbolic keys translates to PHashType[PRubyType[Symbol],value]' do
|
138
|
+
k = calculator.infer({:first => 1, :second => 2}).key_type
|
139
|
+
k.class.should == Puppet::Pops::Types::PRubyType
|
140
|
+
k.ruby_class.should == 'Symbol'
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'with string keys translates to PHashType[PStringType,value]' do
|
144
|
+
calculator.infer({'first' => 1, 'second' => 2}).key_type.class.should == Puppet::Pops::Types::PStringType
|
145
|
+
end
|
146
|
+
|
147
|
+
it 'with fixnum values translates to PHashType[key,PIntegerType]' do
|
148
|
+
calculator.infer({:first => 1, :second => 2}).element_type.class.should == Puppet::Pops::Types::PIntegerType
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
context 'when testing if x is assignable to y' do
|
154
|
+
it 'should allow all object types to PObjectType' do
|
155
|
+
t = Puppet::Pops::Types::PObjectType.new()
|
156
|
+
calculator.assignable?(t, t).should() == true
|
157
|
+
calculator.assignable?(t,Puppet::Pops::Types::PNilType.new()).should() == true
|
158
|
+
calculator.assignable?(t,Puppet::Pops::Types::PDataType.new()).should() == true
|
159
|
+
calculator.assignable?(t,Puppet::Pops::Types::PLiteralType.new()).should() == true
|
160
|
+
calculator.assignable?(t,Puppet::Pops::Types::PStringType.new()).should() == true
|
161
|
+
calculator.assignable?(t,Puppet::Pops::Types::PNumericType.new()).should() == true
|
162
|
+
calculator.assignable?(t,Puppet::Pops::Types::PIntegerType.new()).should() == true
|
163
|
+
calculator.assignable?(t,Puppet::Pops::Types::PFloatType.new()).should() == true
|
164
|
+
calculator.assignable?(t,Puppet::Pops::Types::PPatternType.new()).should() == true
|
165
|
+
calculator.assignable?(t,Puppet::Pops::Types::PBooleanType.new()).should() == true
|
166
|
+
calculator.assignable?(t,Puppet::Pops::Types::PCollectionType.new()).should() == true
|
167
|
+
calculator.assignable?(t,Puppet::Pops::Types::PArrayType.new()).should() == true
|
168
|
+
calculator.assignable?(t,Puppet::Pops::Types::PHashType.new()).should() == true
|
169
|
+
calculator.assignable?(t,Puppet::Pops::Types::PRubyType.new()).should() == true
|
170
|
+
end
|
171
|
+
|
172
|
+
it 'should reject PObjectType to less generic types' do
|
173
|
+
t = Puppet::Pops::Types::PObjectType.new()
|
174
|
+
calculator.assignable?(Puppet::Pops::Types::PDataType.new(), t).should() == false
|
175
|
+
calculator.assignable?(Puppet::Pops::Types::PLiteralType.new(), t).should() == false
|
176
|
+
calculator.assignable?(Puppet::Pops::Types::PStringType.new(), t).should() == false
|
177
|
+
calculator.assignable?(Puppet::Pops::Types::PNumericType.new(), t).should() == false
|
178
|
+
calculator.assignable?(Puppet::Pops::Types::PIntegerType.new(), t).should() == false
|
179
|
+
calculator.assignable?(Puppet::Pops::Types::PFloatType.new(), t).should() == false
|
180
|
+
calculator.assignable?(Puppet::Pops::Types::PPatternType.new(), t).should() == false
|
181
|
+
calculator.assignable?(Puppet::Pops::Types::PBooleanType.new(), t).should() == false
|
182
|
+
calculator.assignable?(Puppet::Pops::Types::PCollectionType.new(), t).should() == false
|
183
|
+
calculator.assignable?(Puppet::Pops::Types::PArrayType.new(), t).should() == false
|
184
|
+
calculator.assignable?(Puppet::Pops::Types::PHashType.new(), t).should() == false
|
185
|
+
calculator.assignable?(Puppet::Pops::Types::PRubyType.new(), t).should() == false
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'should allow all data types, array, and hash to PDataType' do
|
189
|
+
t = Puppet::Pops::Types::PDataType.new()
|
190
|
+
calculator.assignable?(t, t).should() == true
|
191
|
+
calculator.assignable?(t,Puppet::Pops::Types::PLiteralType.new()).should() == true
|
192
|
+
calculator.assignable?(t,Puppet::Pops::Types::PStringType.new()).should() == true
|
193
|
+
calculator.assignable?(t,Puppet::Pops::Types::PNumericType.new()).should() == true
|
194
|
+
calculator.assignable?(t,Puppet::Pops::Types::PIntegerType.new()).should() == true
|
195
|
+
calculator.assignable?(t,Puppet::Pops::Types::PFloatType.new()).should() == true
|
196
|
+
calculator.assignable?(t,Puppet::Pops::Types::PPatternType.new()).should() == true
|
197
|
+
calculator.assignable?(t,Puppet::Pops::Types::PBooleanType.new()).should() == true
|
198
|
+
calculator.assignable?(t,Puppet::Pops::Types::PArrayType.new()).should() == true
|
199
|
+
calculator.assignable?(t,Puppet::Pops::Types::PHashType.new()).should() == true
|
200
|
+
end
|
201
|
+
|
202
|
+
it 'should reject PDataType to less generic data types' do
|
203
|
+
t = Puppet::Pops::Types::PDataType.new()
|
204
|
+
calculator.assignable?(Puppet::Pops::Types::PLiteralType.new(), t).should() == false
|
205
|
+
calculator.assignable?(Puppet::Pops::Types::PStringType.new(), t).should() == false
|
206
|
+
calculator.assignable?(Puppet::Pops::Types::PNumericType.new(), t).should() == false
|
207
|
+
calculator.assignable?(Puppet::Pops::Types::PIntegerType.new(), t).should() == false
|
208
|
+
calculator.assignable?(Puppet::Pops::Types::PFloatType.new(), t).should() == false
|
209
|
+
calculator.assignable?(Puppet::Pops::Types::PPatternType.new(), t).should() == false
|
210
|
+
calculator.assignable?(Puppet::Pops::Types::PBooleanType.new(), t).should() == false
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'should reject PDataType to non data types' do
|
214
|
+
t = Puppet::Pops::Types::PDataType.new()
|
215
|
+
calculator.assignable?(Puppet::Pops::Types::PCollectionType.new(),t).should() == false
|
216
|
+
calculator.assignable?(Puppet::Pops::Types::PArrayType.new(),t).should() == false
|
217
|
+
calculator.assignable?(Puppet::Pops::Types::PHashType.new(),t).should() == false
|
218
|
+
calculator.assignable?(Puppet::Pops::Types::PRubyType.new(), t).should() == false
|
219
|
+
end
|
220
|
+
|
221
|
+
it 'should allow all literal types to PLiteralType' do
|
222
|
+
t = Puppet::Pops::Types::PLiteralType.new()
|
223
|
+
calculator.assignable?(t, t).should() == true
|
224
|
+
calculator.assignable?(t,Puppet::Pops::Types::PStringType.new()).should() == true
|
225
|
+
calculator.assignable?(t,Puppet::Pops::Types::PNumericType.new()).should() == true
|
226
|
+
calculator.assignable?(t,Puppet::Pops::Types::PIntegerType.new()).should() == true
|
227
|
+
calculator.assignable?(t,Puppet::Pops::Types::PFloatType.new()).should() == true
|
228
|
+
calculator.assignable?(t,Puppet::Pops::Types::PPatternType.new()).should() == true
|
229
|
+
calculator.assignable?(t,Puppet::Pops::Types::PBooleanType.new()).should() == true
|
230
|
+
end
|
231
|
+
|
232
|
+
it 'should reject PLiteralType to less generic literal types' do
|
233
|
+
t = Puppet::Pops::Types::PLiteralType.new()
|
234
|
+
calculator.assignable?(Puppet::Pops::Types::PStringType.new(), t).should() == false
|
235
|
+
calculator.assignable?(Puppet::Pops::Types::PNumericType.new(), t).should() == false
|
236
|
+
calculator.assignable?(Puppet::Pops::Types::PIntegerType.new(), t).should() == false
|
237
|
+
calculator.assignable?(Puppet::Pops::Types::PFloatType.new(), t).should() == false
|
238
|
+
calculator.assignable?(Puppet::Pops::Types::PPatternType.new(), t).should() == false
|
239
|
+
calculator.assignable?(Puppet::Pops::Types::PBooleanType.new(), t).should() == false
|
240
|
+
end
|
241
|
+
|
242
|
+
it 'should reject PLiteralType to non literal types' do
|
243
|
+
t = Puppet::Pops::Types::PLiteralType.new()
|
244
|
+
calculator.assignable?(Puppet::Pops::Types::PCollectionType.new(), t).should() == false
|
245
|
+
calculator.assignable?(Puppet::Pops::Types::PArrayType.new(), t).should() == false
|
246
|
+
calculator.assignable?(Puppet::Pops::Types::PHashType.new(), t).should() == false
|
247
|
+
calculator.assignable?(Puppet::Pops::Types::PRubyType.new(), t).should() == false
|
248
|
+
end
|
249
|
+
|
250
|
+
it 'should allow all numeric types to PNumericType' do
|
251
|
+
t = Puppet::Pops::Types::PNumericType.new()
|
252
|
+
calculator.assignable?(t, t).should() == true
|
253
|
+
calculator.assignable?(t, Puppet::Pops::Types::PIntegerType.new()).should() == true
|
254
|
+
calculator.assignable?(t, Puppet::Pops::Types::PFloatType.new()).should() == true
|
255
|
+
end
|
256
|
+
|
257
|
+
it 'should reject PNumericType to less generic numeric types' do
|
258
|
+
t = Puppet::Pops::Types::PNumericType.new()
|
259
|
+
calculator.assignable?(Puppet::Pops::Types::PIntegerType.new(), t).should() == false
|
260
|
+
calculator.assignable?(Puppet::Pops::Types::PFloatType.new(), t).should() == false
|
261
|
+
end
|
262
|
+
|
263
|
+
it 'should reject PNumericType to non numeric types' do
|
264
|
+
t = Puppet::Pops::Types::PNumericType.new()
|
265
|
+
calculator.assignable?(Puppet::Pops::Types::PStringType.new(), t).should() == false
|
266
|
+
calculator.assignable?(Puppet::Pops::Types::PPatternType.new(), t).should() == false
|
267
|
+
calculator.assignable?(Puppet::Pops::Types::PBooleanType.new(), t).should() == false
|
268
|
+
calculator.assignable?(Puppet::Pops::Types::PCollectionType.new(), t).should() == false
|
269
|
+
calculator.assignable?(Puppet::Pops::Types::PArrayType.new(), t).should() == false
|
270
|
+
calculator.assignable?(Puppet::Pops::Types::PHashType.new(), t).should() == false
|
271
|
+
calculator.assignable?(Puppet::Pops::Types::PRubyType.new(), t).should() == false
|
272
|
+
end
|
273
|
+
|
274
|
+
it 'should allow all collection types to PCollectionType' do
|
275
|
+
t = Puppet::Pops::Types::PCollectionType.new()
|
276
|
+
calculator.assignable?(t, t).should() == true
|
277
|
+
calculator.assignable?(t, Puppet::Pops::Types::PArrayType.new()).should() == true
|
278
|
+
calculator.assignable?(t, Puppet::Pops::Types::PHashType.new()).should() == true
|
279
|
+
end
|
280
|
+
|
281
|
+
it 'should reject PCollectionType to less generic collection types' do
|
282
|
+
t = Puppet::Pops::Types::PCollectionType.new()
|
283
|
+
calculator.assignable?(Puppet::Pops::Types::PArrayType.new(), t).should() == false
|
284
|
+
calculator.assignable?(Puppet::Pops::Types::PHashType.new(), t).should() == false
|
285
|
+
end
|
286
|
+
|
287
|
+
it 'should reject PCollectionType to non collection types' do
|
288
|
+
t = Puppet::Pops::Types::PCollectionType.new()
|
289
|
+
calculator.assignable?(Puppet::Pops::Types::PDataType.new(), t).should() == false
|
290
|
+
calculator.assignable?(Puppet::Pops::Types::PLiteralType.new(), t).should() == false
|
291
|
+
calculator.assignable?(Puppet::Pops::Types::PStringType.new(), t).should() == false
|
292
|
+
calculator.assignable?(Puppet::Pops::Types::PNumericType.new(), t).should() == false
|
293
|
+
calculator.assignable?(Puppet::Pops::Types::PIntegerType.new(), t).should() == false
|
294
|
+
calculator.assignable?(Puppet::Pops::Types::PFloatType.new(), t).should() == false
|
295
|
+
calculator.assignable?(Puppet::Pops::Types::PPatternType.new(), t).should() == false
|
296
|
+
calculator.assignable?(Puppet::Pops::Types::PBooleanType.new(), t).should() == false
|
297
|
+
calculator.assignable?(Puppet::Pops::Types::PRubyType.new(), t).should() == false
|
298
|
+
end
|
299
|
+
|
300
|
+
it 'should reject PArrayType to non array type collections' do
|
301
|
+
t = Puppet::Pops::Types::PArrayType.new()
|
302
|
+
calculator.assignable?(Puppet::Pops::Types::PHashType.new(), t).should() == false
|
303
|
+
end
|
304
|
+
|
305
|
+
it 'should reject PHashType to non hash type collections' do
|
306
|
+
t = Puppet::Pops::Types::PHashType.new()
|
307
|
+
calculator.assignable?(Puppet::Pops::Types::PArrayType.new(), t).should() == false
|
308
|
+
end
|
309
|
+
|
310
|
+
it 'should recognize mapped ruby types' do
|
311
|
+
calculator.assignable?(Puppet::Pops::Types::PIntegerType.new(), Integer).should == true
|
312
|
+
calculator.assignable?(Puppet::Pops::Types::PIntegerType.new(), Fixnum).should == true
|
313
|
+
calculator.assignable?(Puppet::Pops::Types::PIntegerType.new(), Bignum).should == true
|
314
|
+
calculator.assignable?(Puppet::Pops::Types::PFloatType.new(), Float).should == true
|
315
|
+
calculator.assignable?(Puppet::Pops::Types::PNumericType.new(), Numeric).should == true
|
316
|
+
calculator.assignable?(Puppet::Pops::Types::PNilType.new(), NilClass).should == true
|
317
|
+
calculator.assignable?(Puppet::Pops::Types::PBooleanType.new(), FalseClass).should == true
|
318
|
+
calculator.assignable?(Puppet::Pops::Types::PBooleanType.new(), TrueClass).should == true
|
319
|
+
calculator.assignable?(Puppet::Pops::Types::PStringType.new(), String).should == true
|
320
|
+
calculator.assignable?(Puppet::Pops::Types::PPatternType.new(), Regexp).should == true
|
321
|
+
calculator.assignable?(Puppet::Pops::Types::TypeFactory.array_of_data(), Array).should == true
|
322
|
+
calculator.assignable?(Puppet::Pops::Types::TypeFactory.hash_of_data(), Hash).should == true
|
323
|
+
end
|
324
|
+
|
325
|
+
it 'should recognize ruby type inheritance' do
|
326
|
+
class Foo
|
327
|
+
end
|
328
|
+
|
329
|
+
class Bar < Foo
|
330
|
+
end
|
331
|
+
|
332
|
+
fooType = calculator.infer(Foo.new)
|
333
|
+
barType = calculator.infer(Bar.new)
|
334
|
+
|
335
|
+
calculator.assignable?(fooType, fooType).should == true
|
336
|
+
calculator.assignable?(Foo, fooType).should == true
|
337
|
+
|
338
|
+
calculator.assignable?(fooType, barType).should == true
|
339
|
+
calculator.assignable?(Foo, barType).should == true
|
340
|
+
|
341
|
+
calculator.assignable?(barType, fooType).should == false
|
342
|
+
calculator.assignable?(Bar, fooType).should == false
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
context 'when testing if x is instance of type t' do
|
347
|
+
it 'should consider fixnum instanceof PIntegerType' do
|
348
|
+
calculator.instance?(Puppet::Pops::Types::PIntegerType.new(), 1)
|
349
|
+
end
|
350
|
+
|
351
|
+
it 'should consider fixnum instanceof Fixnum' do
|
352
|
+
calculator.instance?(Fixnum, 1)
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
context 'when converting a ruby class' do
|
357
|
+
it 'should yield \'PIntegerType\' for Integer, Fixnum, and Bignum' do
|
358
|
+
[Integer,Fixnum,Bignum].each do |c|
|
359
|
+
calculator.type(c).class.should == Puppet::Pops::Types::PIntegerType
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
it 'should yield \'PFloatType\' for Float' do
|
364
|
+
calculator.type(Float).class.should == Puppet::Pops::Types::PFloatType
|
365
|
+
end
|
366
|
+
|
367
|
+
it 'should yield \'PBooleanType\' for FalseClass and TrueClass' do
|
368
|
+
[FalseClass,TrueClass].each do |c|
|
369
|
+
calculator.type(c).class.should == Puppet::Pops::Types::PBooleanType
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
373
|
+
it 'should yield \'PNilType\' for NilClass' do
|
374
|
+
calculator.type(NilClass).class.should == Puppet::Pops::Types::PNilType
|
375
|
+
end
|
376
|
+
|
377
|
+
it 'should yield \'PStringType\' for String' do
|
378
|
+
calculator.type(String).class.should == Puppet::Pops::Types::PStringType
|
379
|
+
end
|
380
|
+
|
381
|
+
it 'should yield \'PPatternType\' for Regexp' do
|
382
|
+
calculator.type(Regexp).class.should == Puppet::Pops::Types::PPatternType
|
383
|
+
end
|
384
|
+
|
385
|
+
it 'should yield \'PArrayType[PDataType]\' for Array' do
|
386
|
+
t = calculator.type(Array)
|
387
|
+
t.class.should == Puppet::Pops::Types::PArrayType
|
388
|
+
t.element_type.class.should == Puppet::Pops::Types::PDataType
|
389
|
+
end
|
390
|
+
|
391
|
+
it 'should yield \'PHashType[PLiteralType,PDataType]\' for Hash' do
|
392
|
+
t = calculator.type(Hash)
|
393
|
+
t.class.should == Puppet::Pops::Types::PHashType
|
394
|
+
t.key_type.class.should == Puppet::Pops::Types::PLiteralType
|
395
|
+
t.element_type.class.should == Puppet::Pops::Types::PDataType
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
context 'when representing the type as string' do
|
400
|
+
it 'should yield \'Type\' for PType' do
|
401
|
+
calculator.string(Puppet::Pops::Types::PType.new()).should == 'Type'
|
402
|
+
end
|
403
|
+
|
404
|
+
it 'should yield \'Object\' for PObjectType' do
|
405
|
+
calculator.string(Puppet::Pops::Types::PObjectType.new()).should == 'Object'
|
406
|
+
end
|
407
|
+
|
408
|
+
it 'should yield \'Literal\' for PLiteralType' do
|
409
|
+
calculator.string(Puppet::Pops::Types::PLiteralType.new()).should == 'Literal'
|
410
|
+
end
|
411
|
+
|
412
|
+
it 'should yield \'Boolean\' for PBooleanType' do
|
413
|
+
calculator.string(Puppet::Pops::Types::PBooleanType.new()).should == 'Boolean'
|
414
|
+
end
|
415
|
+
|
416
|
+
it 'should yield \'Data\' for PDataType' do
|
417
|
+
calculator.string(Puppet::Pops::Types::PDataType.new()).should == 'Data'
|
418
|
+
end
|
419
|
+
|
420
|
+
it 'should yield \'Numeric\' for PNumericType' do
|
421
|
+
calculator.string(Puppet::Pops::Types::PNumericType.new()).should == 'Numeric'
|
422
|
+
end
|
423
|
+
|
424
|
+
it 'should yield \'Integer\' for PIntegerType' do
|
425
|
+
calculator.string(Puppet::Pops::Types::PIntegerType.new()).should == 'Integer'
|
426
|
+
end
|
427
|
+
|
428
|
+
it 'should yield \'Float\' for PFloatType' do
|
429
|
+
calculator.string(Puppet::Pops::Types::PFloatType.new()).should == 'Float'
|
430
|
+
end
|
431
|
+
|
432
|
+
it 'should yield \'Pattern\' for PPatternType' do
|
433
|
+
calculator.string(Puppet::Pops::Types::PPatternType.new()).should == 'Pattern'
|
434
|
+
end
|
435
|
+
|
436
|
+
it 'should yield \'String\' for PStringType' do
|
437
|
+
calculator.string(Puppet::Pops::Types::PStringType.new()).should == 'String'
|
438
|
+
end
|
439
|
+
|
440
|
+
it 'should yield \'Array[Integer]\' for PArrayType[PIntegerType]' do
|
441
|
+
t = Puppet::Pops::Types::PArrayType.new()
|
442
|
+
t.element_type = Puppet::Pops::Types::PIntegerType.new()
|
443
|
+
calculator.string(t).should == 'Array[Integer]'
|
444
|
+
end
|
445
|
+
|
446
|
+
it 'should yield \'Hash[String, Integer]\' for PHashType[PStringType, PIntegerType]' do
|
447
|
+
t = Puppet::Pops::Types::PHashType.new()
|
448
|
+
t.key_type = Puppet::Pops::Types::PStringType.new()
|
449
|
+
t.element_type = Puppet::Pops::Types::PIntegerType.new()
|
450
|
+
calculator.string(t).should == 'Hash[String, Integer]'
|
451
|
+
end
|
452
|
+
end
|
453
|
+
|
454
|
+
context 'when processing meta type' do
|
455
|
+
it 'should infer PType as the type of all other types' do
|
456
|
+
ptype = Puppet::Pops::Types::PType
|
457
|
+
calculator.infer(Puppet::Pops::Types::PNilType.new() ).is_a?(ptype).should() == true
|
458
|
+
calculator.infer(Puppet::Pops::Types::PDataType.new() ).is_a?(ptype).should() == true
|
459
|
+
calculator.infer(Puppet::Pops::Types::PLiteralType.new() ).is_a?(ptype).should() == true
|
460
|
+
calculator.infer(Puppet::Pops::Types::PStringType.new() ).is_a?(ptype).should() == true
|
461
|
+
calculator.infer(Puppet::Pops::Types::PNumericType.new() ).is_a?(ptype).should() == true
|
462
|
+
calculator.infer(Puppet::Pops::Types::PIntegerType.new() ).is_a?(ptype).should() == true
|
463
|
+
calculator.infer(Puppet::Pops::Types::PFloatType.new() ).is_a?(ptype).should() == true
|
464
|
+
calculator.infer(Puppet::Pops::Types::PPatternType.new() ).is_a?(ptype).should() == true
|
465
|
+
calculator.infer(Puppet::Pops::Types::PBooleanType.new() ).is_a?(ptype).should() == true
|
466
|
+
calculator.infer(Puppet::Pops::Types::PCollectionType.new()).is_a?(ptype).should() == true
|
467
|
+
calculator.infer(Puppet::Pops::Types::PArrayType.new() ).is_a?(ptype).should() == true
|
468
|
+
calculator.infer(Puppet::Pops::Types::PHashType.new() ).is_a?(ptype).should() == true
|
469
|
+
calculator.infer(Puppet::Pops::Types::PRubyType.new() ).is_a?(ptype).should() == true
|
470
|
+
end
|
471
|
+
|
472
|
+
it 'should infer PType as the type of ruby classes' do
|
473
|
+
class Foo
|
474
|
+
end
|
475
|
+
[Object, Numeric, Integer, Fixnum, Bignum, Float, String, Regexp, Array, Hash, Foo].each do |c|
|
476
|
+
calculator.infer(c).is_a?(Puppet::Pops::Types::PType).should() == true
|
477
|
+
end
|
478
|
+
end
|
479
|
+
|
480
|
+
it 'should infer PType as the type of PType (meta regression short-circuit)' do
|
481
|
+
calculator.infer(Puppet::Pops::Types::PType.new()).is_a?(Puppet::Pops::Types::PType).should() == true
|
482
|
+
end
|
483
|
+
end
|
484
|
+
end
|