HomePhorge

(#11246) Add UTF-8 String#to_yaml spec tests
a01aab2ce758Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(#11246) Add UTF-8 String#to_yaml spec tests

This patch adds a specification test to validate that Puppet can
properly serialize a UTF-8 encoded string to YAML. Without this patch
we don't have a test that covers this desired behavior.

This patch provides an automated way to reproduce the bug reported in
ticket #11246.

The specific test for #11246 that will fail with Ruby 1.9 but not with 1.8 are
these two. The tests encode and catch our expectation that UTF-8 encoded
strings properly serialize and de-serialize to and from YAML.

  1. UTF-8 String YAML Handling (Bug #11246) UTF-8 String Literal should serialize to YAML Failure/Error: subject.to_yaml Encoding::CompatibilityError: incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)
    1. ./lib/puppet/util/zaml.rb:241:in `block in to_zaml'
    2. ./lib/puppet/util/zaml.rb:90:in `first_time_only'
    3. ./lib/puppet/util/zaml.rb:227:in `to_zaml'
    4. ./lib/puppet/util/zaml.rb:22:in `dump'
    5. ./lib/puppet/util/monkey_patches.rb:32:in `to_yaml'
    6. ./spec/unit/util/zaml_spec.rb:83:in `block (3 levels) in <top (required)>'
  2. UTF-8 String YAML Handling (Bug #11246) UTF-8 String Literal should serialize and deserialize to the same thing Failure/Error: YAML.load(subject.to_yaml).should == subject Encoding::CompatibilityError: incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)
    1. ./lib/puppet/util/zaml.rb:241:in `block in to_zaml'
    2. ./lib/puppet/util/zaml.rb:90:in `first_time_only'
    3. ./lib/puppet/util/zaml.rb:227:in `to_zaml'
    4. ./lib/puppet/util/zaml.rb:22:in `dump'
    5. ./lib/puppet/util/monkey_patches.rb:32:in `to_yaml'
    6. ./spec/unit/util/zaml_spec.rb:86:in `block (3 levels) in <top (required)>'

Details

Provenance
Jeff McCune <jeff@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU5e46f6ae171a: Merge remote-tracking branch 'nanliu/ticket/2.7.x/8547' into 2.7.x
Branches
Unknown
Tags
Unknown

Event Timeline

Jeff McCune <jeff@puppetlabs.com> committed rPUa01aab2ce758: (#11246) Add UTF-8 String#to_yaml spec tests (authored by Jeff McCune <jeff@puppetlabs.com>).Dec 7 2011, 8:13 PM