puppetlabs / puppet-strings

The next generation Puppet documentation extraction and presentation tool.
http://puppetlabs.github.io/puppet-strings/
Apache License 2.0
90 stars 84 forks source link

(#307) Fix plan parsing in JSON spec tests #311

Closed danielparks closed 2 years ago

danielparks commented 2 years ago

This is 3 closely related commits. I’m not totally satisfied with this solution — I would be inclined to set Puppet[:tasks] = true regardless of the file name, but I’m not really sure what all the implications would be.

Catch parse failures in PuppetStrings::Json tests

Previously, the tests for PuppetStrings::Json (in json_spec.rb) parsed a variety of code samples and then queried YARD to test the results. If a sample failed to parse, an error might be outputted (see issue #307), but no failure was registered by the testing harness.

This adds simple checks to verify that the parses actually succeed.

Unfortunately, one of the samples currently fails to parse, so this commit introduces a testing error. The subbsequent commit will fix it.

(#307) Fix plan parsing in JSON spec tests

Previously, parsing of Puppet plan code failed in json_spec.rb because it didn’t provide a file name to the parser, which prevented the parser from enabling task support in Puppet, which prevented the parser from recognizing a plan.

This turns on task support in Puppet before trying to parse a plan in json_spec.rb.

Add a plan test to parser_spec.rb

Previously, none of the examples in parser_spec.rb included a Puppet plan. This adds a plan and verifies that it parses correctly.

danielparks commented 2 years ago

I’m inclined to close this in favor of #312, but I figured I’d let somebody else make the call. Sorry for the noise!

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.

danielparks commented 2 years ago

Closing in favor of #312.