├── .gitignore ├── vendor └── github.com │ ├── onsi │ ├── gomega │ │ ├── .gitignore │ │ ├── matchers │ │ │ ├── support │ │ │ │ └── goraph │ │ │ │ │ ├── node │ │ │ │ │ └── node.go │ │ │ │ │ ├── util │ │ │ │ │ └── util.go │ │ │ │ │ ├── MIT.LICENSE │ │ │ │ │ ├── bipartitegraph │ │ │ │ │ └── bipartitegraph.go │ │ │ │ │ └── edge │ │ │ │ │ └── edge.go │ │ │ ├── matcher_tests_suite_test.go │ │ │ ├── be_true_matcher_test.go │ │ │ ├── be_false_matcher_test.go │ │ │ ├── be_nil_matcher.go │ │ │ ├── be_nil_matcher_test.go │ │ │ ├── be_true_matcher.go │ │ │ ├── be_false_matcher.go │ │ │ ├── be_zero_matcher.go │ │ │ ├── be_empty_matcher.go │ │ │ ├── be_zero_matcher_test.go │ │ │ ├── have_occurred_matcher_test.go │ │ │ ├── equal_matcher.go │ │ │ ├── succeed_matcher.go │ │ │ ├── have_len_matcher.go │ │ │ ├── succeed_matcher_test.go │ │ │ ├── have_occurred_matcher.go │ │ │ ├── assignable_to_type_of_matcher.go │ │ │ ├── be_an_existing_file.go │ │ │ ├── assignable_to_type_of_matcher_test.go │ │ │ ├── have_prefix_matcher_test.go │ │ │ ├── have_suffix_matcher_test.go │ │ │ ├── have_prefix_matcher.go │ │ │ ├── be_equivalent_to_matcher.go │ │ │ ├── have_suffix_matcher.go │ │ │ ├── be_a_directory_test.go │ │ │ ├── be_a_regular_file_test.go │ │ │ ├── contain_substring_matcher_test.go │ │ │ ├── panic_matcher_test.go │ │ │ ├── be_an_existing_file_test.go │ │ │ ├── contain_substring_matcher.go │ │ │ ├── panic_matcher.go │ │ │ ├── match_regexp_matcher.go │ │ │ ├── be_closed_matcher.go │ │ │ ├── be_empty_matcher_test.go │ │ │ ├── match_regexp_matcher_test.go │ │ │ ├── be_a_directory.go │ │ │ ├── be_a_regular_file.go │ │ │ ├── have_len_matcher_test.go │ │ │ ├── match_error_matcher.go │ │ │ ├── have_key_matcher.go │ │ │ ├── be_equivalent_to_matcher_test.go │ │ │ ├── contain_element_matcher.go │ │ │ ├── match_json_matcher.go │ │ │ ├── be_temporally_matcher.go │ │ │ ├── equal_matcher_test.go │ │ │ └── match_json_matcher_test.go │ │ ├── internal │ │ │ ├── testingtsupport │ │ │ │ ├── testing_t_support_test.go │ │ │ │ └── testing_t_support.go │ │ │ ├── assertion │ │ │ │ └── assertion_suite_test.go │ │ │ ├── asyncassertion │ │ │ │ └── async_assertion_suite_test.go │ │ │ └── fakematcher │ │ │ │ └── fake_matcher.go │ │ ├── format │ │ │ └── format_suite_test.go │ │ ├── gbytes │ │ │ └── gbuffer_suite_test.go │ │ ├── ghttp │ │ │ └── test_server_suite_test.go │ │ ├── .travis.yml │ │ ├── gexec │ │ │ ├── gexec_suite_test.go │ │ │ ├── prefixed_writer_test.go │ │ │ └── prefixed_writer.go │ │ ├── types │ │ │ └── types.go │ │ ├── README.md │ │ └── LICENSE │ └── ginkgo │ │ ├── integration │ │ ├── integration.go │ │ ├── tags_test.go │ │ ├── coverage_test.go │ │ ├── interrupt_test.go │ │ └── precompiled_test.go │ │ ├── .gitignore │ │ ├── ginkgo │ │ ├── interrupthandler │ │ │ ├── sigquit_swallower_windows.go │ │ │ ├── sigquit_swallower_unix.go │ │ │ └── interrupt_handler.go │ │ ├── testsuite │ │ │ └── testsuite_suite_test.go │ │ ├── version_command.go │ │ ├── watch │ │ │ ├── delta.go │ │ │ ├── package_hashes.go │ │ │ └── delta_tracker.go │ │ ├── testrunner │ │ │ ├── run_result.go │ │ │ └── log_writer.go │ │ ├── help_command.go │ │ ├── unfocus_command.go │ │ ├── convert_command.go │ │ ├── convert │ │ │ └── test_finder.go │ │ ├── notifications.go │ │ └── build_command.go │ │ ├── internal │ │ ├── spec │ │ │ ├── spec_suite_test.go │ │ │ └── index_computer.go │ │ ├── failer │ │ │ ├── failer_suite_test.go │ │ │ └── failer.go │ │ ├── writer │ │ │ ├── writer_suite_test.go │ │ │ ├── fake_writer.go │ │ │ └── writer.go │ │ ├── leafnodes │ │ │ ├── leaf_node_suite_test.go │ │ │ ├── interfaces.go │ │ │ ├── it_node_test.go │ │ │ ├── it_node.go │ │ │ ├── setup_nodes.go │ │ │ ├── setup_nodes_test.go │ │ │ ├── measure_node.go │ │ │ └── suite_nodes.go │ │ ├── remote │ │ │ ├── remote_suite_test.go │ │ │ ├── output_interceptor.go │ │ │ ├── fake_output_interceptor_test.go │ │ │ ├── fake_poster_test.go │ │ │ ├── output_interceptor_win.go │ │ │ └── output_interceptor_test.go │ │ ├── specrunner │ │ │ ├── spec_runner_suite_test.go │ │ │ └── random_id.go │ │ ├── codelocation │ │ │ ├── code_location_suite_test.go │ │ │ └── code_location.go │ │ ├── containernode │ │ │ └── container_node_suite_test.go │ │ ├── suite │ │ │ └── suite_suite_test.go │ │ └── testingtproxy │ │ │ └── testing_t_proxy.go │ │ ├── types │ │ ├── types_suite_test.go │ │ ├── code_location.go │ │ └── synchronization.go │ │ ├── reporters │ │ ├── reporters_suite_test.go │ │ ├── reporter.go │ │ ├── stenographer │ │ │ └── console_logging.go │ │ └── fake_reporter.go │ │ ├── .travis.yml │ │ └── LICENSE │ ├── cloudfoundry-incubator │ └── candiedyaml │ │ ├── .gitignore │ │ ├── fixtures │ │ └── specification │ │ │ ├── example_empty.yaml │ │ │ ├── example2_17_single.yaml │ │ │ ├── example2_17_tie_fighter.yaml │ │ │ ├── example2_17_hexesc.yaml │ │ │ ├── example2_17_control.yaml │ │ │ ├── example2_17_quoted.yaml │ │ │ ├── example2_17_unicode.yaml │ │ │ ├── example2_1.yaml │ │ │ ├── example2_23_non_date.yaml │ │ │ ├── example2_13.yaml │ │ │ ├── example2_21.yaml │ │ │ ├── example2_14.yaml │ │ │ ├── example2_19.yaml │ │ │ ├── types │ │ │ ├── v.yaml │ │ │ ├── map.yaml │ │ │ ├── set.yaml │ │ │ ├── map_mixed_tags.yaml │ │ │ ├── value.yaml │ │ │ ├── pairs.yaml │ │ │ ├── omap.yaml │ │ │ ├── merge.yaml │ │ │ └── seq.yaml │ │ │ ├── example2_2.yaml │ │ │ ├── example2_5.yaml │ │ │ ├── example2_6.yaml │ │ │ ├── example2_18.yaml │ │ │ ├── example2_4.yaml │ │ │ ├── example2_20.yaml │ │ │ ├── example2_22.yaml │ │ │ ├── example2_9.yaml │ │ │ ├── example2_23_application.yaml │ │ │ ├── example2_15.yaml │ │ │ ├── example2_15_dumped.yaml │ │ │ ├── example2_10.yaml │ │ │ ├── example2_3.yaml │ │ │ ├── example2_16.yaml │ │ │ ├── example2_12.yaml │ │ │ ├── example2_23_picture.yaml │ │ │ ├── example2_25.yaml │ │ │ ├── example2_8.yaml │ │ │ ├── example2_7.yaml │ │ │ ├── example2_11.yaml │ │ │ ├── example2_26.yaml │ │ │ ├── example2_17.yaml │ │ │ ├── example2_24_dumped.yaml │ │ │ ├── example2_23.yaml │ │ │ ├── example2_24.yaml │ │ │ ├── example2_28.yaml │ │ │ ├── example2_27_dumped.yaml │ │ │ └── example2_27.yaml │ │ ├── .travis.yml │ │ ├── yaml_definesh.go │ │ ├── candiedyaml_suite_test.go │ │ ├── libyaml-LICENSE │ │ ├── README.md │ │ └── run_parser.go │ └── codegangsta │ └── cli │ ├── .travis.yml │ ├── autocomplete │ ├── zsh_autocomplete │ └── bash_autocomplete │ ├── helpers_test.go │ ├── cli.go │ ├── LICENSE │ └── command_test.go ├── dynaml ├── node.go ├── failing_expr_helper_test.go ├── nil_test.go ├── integer_test.go ├── string_test.go ├── nil.go ├── merge.go ├── boolean_test.go ├── expression.go ├── string.go ├── boolean.go ├── integer.go ├── init_test.go ├── or.go ├── list.go ├── addition.go ├── subtraction.go ├── fake_binding_helper_test.go ├── reference.go ├── addition_test.go ├── subtraction_test.go ├── fail_to_evaluate_helper_test.go ├── list_test.go ├── auto.go ├── merge_test.go ├── dynaml.peg ├── concatenation.go ├── reference_test.go ├── auto_test.go ├── evaluate_as_helper_test.go └── or_test.go ├── scripts ├── build └── test ├── flow ├── cascade.go ├── init_test.go ├── unresolved_check_test.go ├── cascade_as_helper_test.go ├── cascade_test.go ├── environment.go ├── flow_as_helper_test.go └── unresolved_check.go ├── yaml ├── init_test.go ├── parser.go ├── find.go └── node.go ├── Makefile ├── NOTICE ├── compare └── init_test.go ├── init_test.go ├── spiff_test.go └── examples └── tutorial.md /.gitignore: -------------------------------------------------------------------------------- 1 | tags 2 | *.coverprofile 3 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.test 3 | . 4 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/.gitignore: -------------------------------------------------------------------------------- 1 | *.coverprofile 2 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/integration/integration.go: -------------------------------------------------------------------------------- 1 | package integration 2 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | TODO 3 | tmp/**/* 4 | *.coverprofile -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example_empty.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_17_single.yaml: -------------------------------------------------------------------------------- 1 | single: '"Howdy!" he cried.' 2 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_17_tie_fighter.yaml: -------------------------------------------------------------------------------- 1 | tie-fighter: '|\-*-/|' 2 | -------------------------------------------------------------------------------- /vendor/github.com/codegangsta/cli/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 1.1 3 | 4 | script: 5 | - go vet ./... 6 | - go test -v ./... 7 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_17_hexesc.yaml: -------------------------------------------------------------------------------- 1 | hexesc: "\x0D\x0A is \r\n" 2 | 3 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_17_control.yaml: -------------------------------------------------------------------------------- 1 | control: "\b1998\t1999\t2000\n" 2 | 3 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_17_quoted.yaml: -------------------------------------------------------------------------------- 1 | quoted: ' # not a ''comment''.' 2 | 3 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_17_unicode.yaml: -------------------------------------------------------------------------------- 1 | unicode: "Sosa did fine.\u263A" 2 | 3 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_1.yaml: -------------------------------------------------------------------------------- 1 | - Mark McGwire 2 | - Sammy Sosa 3 | - Ken Griffey 4 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_23_non_date.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | not-date: !!str 2002-04-28 3 | 4 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_13.yaml: -------------------------------------------------------------------------------- 1 | # ASCII Art 2 | --- | 3 | \//||\/|| 4 | // || ||__ 5 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_21.yaml: -------------------------------------------------------------------------------- 1 | null: ~ 2 | true: yes 3 | false: no 4 | string: '12345' 5 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/support/goraph/node/node.go: -------------------------------------------------------------------------------- 1 | package node 2 | 3 | type Node struct { 4 | Id int 5 | } 6 | 7 | type NodeOrderedSet []Node 8 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_14.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Mark McGwire's 3 | year was crippled 4 | by a knee injury. 5 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_19.yaml: -------------------------------------------------------------------------------- 1 | canonical: 12345 2 | decimal: +12_345 3 | octal: 014 4 | hexadecimal: 0xC 5 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/types/v.yaml: -------------------------------------------------------------------------------- 1 | --- # New schema 2 | link with: 3 | - = : library1.dll 4 | version: 1.2 5 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_2.yaml: -------------------------------------------------------------------------------- 1 | hr: 65 # Home runs 2 | avg: 0.278 # Batting average 3 | rbi: 147 # Runs Batted In 4 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_5.yaml: -------------------------------------------------------------------------------- 1 | - [name , hr, avg ] 2 | - [Mark McGwire, 65, 0.278] 3 | - [Sammy Sosa , 63, 0.288] 4 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_6.yaml: -------------------------------------------------------------------------------- 1 | Mark McGwire: {hr: 65, avg: 0.278} 2 | Sammy Sosa: { 3 | hr: 63, 4 | avg: 0.288 5 | } 6 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/interrupthandler/sigquit_swallower_windows.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package interrupthandler 4 | 5 | func SwallowSigQuit() { 6 | //noop 7 | } 8 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/support/goraph/util/util.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import "math" 4 | 5 | func Odd(n int) bool { 6 | return math.Mod(float64(n), 2.0) == 1.0 7 | } 8 | -------------------------------------------------------------------------------- /dynaml/node.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "github.com/cloudfoundry-incubator/spiff/yaml" 5 | ) 6 | 7 | func node(val interface{}) yaml.Node { 8 | return yaml.NewNode(val, "dynaml") 9 | } 10 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_18.yaml: -------------------------------------------------------------------------------- 1 | plain: 2 | This unquoted scalar 3 | spans many lines. 4 | 5 | quoted: "So does this 6 | quoted scalar.\n" 7 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_4.yaml: -------------------------------------------------------------------------------- 1 | - 2 | name: Mark McGwire 3 | hr: 65 4 | avg: 0.278 5 | - 6 | name: Sammy Sosa 7 | hr: 63 8 | avg: 0.288 9 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_20.yaml: -------------------------------------------------------------------------------- 1 | canonical: 1.23015e+3 2 | exponential: 12.3015e+02 3 | fixed: 1_230.15 4 | negative infinity: -.inf 5 | not a number: .NaN 6 | -------------------------------------------------------------------------------- /vendor/github.com/codegangsta/cli/autocomplete/zsh_autocomplete: -------------------------------------------------------------------------------- 1 | autoload -U compinit && compinit 2 | autoload -U bashcompinit && bashcompinit 3 | 4 | script_dir=$(dirname $0) 5 | source ${script_dir}/bash_autocomplete 6 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_22.yaml: -------------------------------------------------------------------------------- 1 | canonical: 2001-12-15T02:59:43.1Z 2 | iso8601: 2001-12-14t21:59:43.10-05:00 3 | spaced: 2001-12-14 21:59:43.10 -5 4 | date: 2002-12-14 5 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_9.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | hr: # 1998 hr ranking 3 | - Mark McGwire 4 | - Sammy Sosa 5 | rbi: 6 | # 1998 rbi ranking 7 | - Sammy Sosa 8 | - Ken Griffey 9 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_23_application.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | application specific tag: !something | 3 | The semantics of the tag 4 | above may be different for 5 | different documents. 6 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_15.yaml: -------------------------------------------------------------------------------- 1 | > 2 | Sammy Sosa completed another 3 | fine season with great stats. 4 | 5 | 63 Home Runs 6 | 0.288 Batting Average 7 | 8 | What a year! 9 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_15_dumped.yaml: -------------------------------------------------------------------------------- 1 | > 2 | Sammy Sosa completed another fine season with great stats. 3 | 4 | 63 Home Runs 5 | 0.288 Batting Average 6 | 7 | What a year! -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_10.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | hr: 3 | - Mark McGwire 4 | # Following node labeled SS 5 | - &SS Sammy Sosa 6 | rbi: 7 | - *SS # Subsequent occurrence 8 | - Ken Griffey 9 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_3.yaml: -------------------------------------------------------------------------------- 1 | american: 2 | - Boston Red Sox 3 | - Detroit Tigers 4 | - New York Yankees 5 | national: 6 | - New York Mets 7 | - Chicago Cubs 8 | - Atlanta Braves -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_16.yaml: -------------------------------------------------------------------------------- 1 | name: Mark McGwire 2 | accomplishment: > 3 | Mark set a major league 4 | home run record in 1998. 5 | stats: | 6 | 65 Home Runs 7 | 0.278 Batting Average 8 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_12.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # products purchased 3 | - item : Super Hoop 4 | quantity: 1 5 | - item : Basketball 6 | quantity: 4 7 | - item : Big Shoes 8 | quantity: 1 9 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_23_picture.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | picture: !!binary "\ 3 | R0lGODlhDAAMAIQAAP//9/X\ 4 | 17unp5WZmZgAAAOfn515eXv\ 5 | Pz7Y6OjuDg4J+fn5OTk6enp\ 6 | 56enmleECcgggoBADs=" 7 | 8 | 9 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_25.yaml: -------------------------------------------------------------------------------- 1 | # sets are represented as a 2 | # mapping where each key is 3 | # associated with the empty string 4 | --- !!set 5 | ? Mark McGwire 6 | ? Sammy Sosa 7 | ? Ken Griff 8 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_8.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | time: 20:03:20 3 | player: Sammy Sosa 4 | action: strike (miss) 5 | ... 6 | --- 7 | time: 20:03:47 8 | player: Sammy Sosa 9 | action: grand slam 10 | ... 11 | -------------------------------------------------------------------------------- /dynaml/failing_expr_helper_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "github.com/cloudfoundry-incubator/spiff/yaml" 5 | ) 6 | 7 | type FailingExpr struct{} 8 | 9 | func (FailingExpr) Evaluate(Binding) (yaml.Node, bool) { 10 | return nil, false 11 | } 12 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_7.yaml: -------------------------------------------------------------------------------- 1 | # Ranking of 1998 home runs 2 | --- 3 | - Mark McGwire 4 | - Sammy Sosa 5 | - Ken Griffey 6 | 7 | # Team ranking 8 | --- 9 | - Chicago Cubs 10 | - St Louis Cardinals 11 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_11.yaml: -------------------------------------------------------------------------------- 1 | ? - Detroit Tigers 2 | - Chicago cubs 3 | : 4 | - 2001-07-23 5 | 6 | ? [ New York Yankees, 7 | Atlanta Braves ] 8 | : [ 2001-07-02, 2001-08-12, 9 | 2001-08-14 ] 10 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_26.yaml: -------------------------------------------------------------------------------- 1 | # ordered maps are represented as 2 | # a sequence of mappings, with 3 | # each mapping having one key 4 | --- !!omap 5 | - Mark McGwire: 65 6 | - Sammy Sosa: 63 7 | - Ken Griffy: 58 8 | -------------------------------------------------------------------------------- /dynaml/nil_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | ) 7 | 8 | var _ = Describe("nil", func() { 9 | It("evaluates to nil", func() { 10 | Expect(NilExpr{}).To(EvaluateAs(nil, FakeBinding{})) 11 | }) 12 | }) 13 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/types/map.yaml: -------------------------------------------------------------------------------- 1 | # Unordered set of key: value pairs. 2 | Block style: !!map 3 | Clark : Evans 4 | Brian : Ingerson 5 | Oren : Ben-Kiki 6 | Flow style: !!map { Clark: Evans, Brian: Ingerson, Oren: Ben-Kiki } 7 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_17.yaml: -------------------------------------------------------------------------------- 1 | unicode: "Sosa did fine.\u263A" 2 | control: "\b1998\t1999\t2000\n" 3 | hexesc: "\x0D\x0A is \r\n" 4 | 5 | single: '"Howdy!" he cried.' 6 | quoted: ' # not a ''comment''.' 7 | tie-fighter: '|\-*-/|' 8 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/types/set.yaml: -------------------------------------------------------------------------------- 1 | # Explicitly typed set. 2 | baseball players: !!set 3 | ? Mark McGwire 4 | ? Sammy Sosa 5 | ? Ken Griffey 6 | # Flow style 7 | baseball teams: !!set { Boston Red Sox, Detroit Tigers, New York Yankees } 8 | -------------------------------------------------------------------------------- /dynaml/integer_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | ) 7 | 8 | var _ = Describe("integers", func() { 9 | It("evaluates to an int", func() { 10 | Expect(IntegerExpr{42}).To(EvaluateAs(42, FakeBinding{})) 11 | }) 12 | }) 13 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support_test.go: -------------------------------------------------------------------------------- 1 | package testingtsupport_test 2 | 3 | import ( 4 | . "github.com/onsi/gomega" 5 | 6 | "testing" 7 | ) 8 | 9 | func TestTestingT(t *testing.T) { 10 | RegisterTestingT(t) 11 | Ω(true).Should(BeTrue()) 12 | } 13 | -------------------------------------------------------------------------------- /dynaml/string_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | ) 7 | 8 | var _ = Describe("integers", func() { 9 | It("evaluates to an int", func() { 10 | Expect(StringExpr{"foo"}).To(EvaluateAs("foo", FakeBinding{})) 11 | }) 12 | }) 13 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/spec/spec_suite_test.go: -------------------------------------------------------------------------------- 1 | package spec_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestSpec(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Spec Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/types/types_suite_test.go: -------------------------------------------------------------------------------- 1 | package types_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestTypes(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Types Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/types/map_mixed_tags.yaml: -------------------------------------------------------------------------------- 1 | # Unordered set of key: value pairs. 2 | Block style: ! 3 | Clark : Evans 4 | Brian : Ingerson 5 | Oren : Ben-Kiki 6 | Flow style: { Clark: Evans, Brian: Ingerson, Oren: Ben-Kiki } 7 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/types/value.yaml: -------------------------------------------------------------------------------- 1 | --- # Old schema 2 | link with: 3 | - library1.dll 4 | - library2.dll 5 | --- # New schema 6 | link with: 7 | - = : library1.dll 8 | version: 1.2 9 | - = : library2.dll 10 | version: 2.3 11 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/format/format_suite_test.go: -------------------------------------------------------------------------------- 1 | package format_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestFormat(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Format Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/gbytes/gbuffer_suite_test.go: -------------------------------------------------------------------------------- 1 | package gbytes_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestGbytes(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Gbytes Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/ghttp/test_server_suite_test.go: -------------------------------------------------------------------------------- 1 | package ghttp_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestGHTTP(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "GHTTP Suite") 13 | } 14 | -------------------------------------------------------------------------------- /dynaml/nil.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "github.com/cloudfoundry-incubator/spiff/yaml" 5 | ) 6 | 7 | type NilExpr struct{} 8 | 9 | func (e NilExpr) Evaluate(Binding) (yaml.Node, bool) { 10 | return node(nil), true 11 | } 12 | 13 | func (e NilExpr) String() string { 14 | return "nil" 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/types/pairs.yaml: -------------------------------------------------------------------------------- 1 | # Explicitly typed pairs. 2 | Block tasks: !!pairs 3 | - meeting: with team. 4 | - meeting: with boss. 5 | - break: lunch. 6 | - meeting: with client. 7 | Flow tasks: !!pairs [ meeting: with team, meeting: with boss ] 8 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/failer/failer_suite_test.go: -------------------------------------------------------------------------------- 1 | package failer_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestFailer(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Failer Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/writer/writer_suite_test.go: -------------------------------------------------------------------------------- 1 | package writer_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestWriter(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Writer Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.3 4 | 5 | install: 6 | - go get -v ./... 7 | - go get github.com/onsi/ginkgo 8 | - go install github.com/onsi/ginkgo/ginkgo 9 | 10 | script: $HOME/gopath/bin/ginkgo -r --randomizeAllSpecs --failOnPending --randomizeSuites --race 11 | -------------------------------------------------------------------------------- /scripts/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # vim: set ft=sh 3 | 4 | set -e -x -u 5 | cd $(dirname ${BASH_SOURCE[0]})/.. 6 | export GOPATH=$PWD/Godeps/_workspace:$GOPATH 7 | 8 | FIRST_GOPATH=`echo $GOPATH | cut -d':' -f1` 9 | 10 | mkdir -p $FIRST_GOPATH/bin 11 | export PATH=$FIRST_GOPATH/bin:$PATH 12 | 13 | go build spiff.go 14 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - 1.4.1 5 | 6 | install: 7 | - go get -t -v ./... 8 | - go install github.com/onsi/ginkgo/ginkgo 9 | 10 | script: 11 | - export PATH=$HOME/gopath/bin:$PATH 12 | - ginkgo -r -failOnPending -randomizeAllSpecs -race 13 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/reporters_suite_test.go: -------------------------------------------------------------------------------- 1 | package reporters_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestReporters(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Reporters Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_24_dumped.yaml: -------------------------------------------------------------------------------- 1 | !shape 2 | - !circle 3 | center: &id001 {x: 73, y: 129} 4 | radius: 7 5 | - !line 6 | finish: {x: 89, y: 102} 7 | start: *id001 8 | - !label 9 | color: 0xFFEEBB 10 | start: *id001 11 | text: Pretty vector drawing. -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/testsuite/testsuite_suite_test.go: -------------------------------------------------------------------------------- 1 | package testsuite_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestTestsuite(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Testsuite Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/leafnodes/leaf_node_suite_test.go: -------------------------------------------------------------------------------- 1 | package leafnodes_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestLeafNode(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "LeafNode Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/internal/assertion/assertion_suite_test.go: -------------------------------------------------------------------------------- 1 | package assertion_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestAssertion(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Assertion Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/remote/remote_suite_test.go: -------------------------------------------------------------------------------- 1 | package remote_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestRemote(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Remote Spec Forwarding Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner_suite_test.go: -------------------------------------------------------------------------------- 1 | package specrunner_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestSpecRunner(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Spec Runner Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/codelocation/code_location_suite_test.go: -------------------------------------------------------------------------------- 1 | package codelocation_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestCodelocation(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "CodeLocation Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/containernode/container_node_suite_test.go: -------------------------------------------------------------------------------- 1 | package containernode_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestContainernode(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Containernode Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/specrunner/random_id.go: -------------------------------------------------------------------------------- 1 | package specrunner 2 | 3 | import ( 4 | "crypto/rand" 5 | "fmt" 6 | ) 7 | 8 | func randomID() string { 9 | b := make([]byte, 8) 10 | _, err := rand.Read(b) 11 | if err != nil { 12 | return "" 13 | } 14 | return fmt.Sprintf("%x-%x-%x-%x", b[0:2], b[2:4], b[4:6], b[6:8]) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_suite_test.go: -------------------------------------------------------------------------------- 1 | package asyncassertion_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func TestAsyncAssertion(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "AsyncAssertion Suite") 13 | } 14 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/interrupthandler/sigquit_swallower_unix.go: -------------------------------------------------------------------------------- 1 | // +build freebsd openbsd netbsd dragonfly darwin linux 2 | 3 | package interrupthandler 4 | 5 | import ( 6 | "os" 7 | "os/signal" 8 | "syscall" 9 | ) 10 | 11 | func SwallowSigQuit() { 12 | c := make(chan os.Signal, 1024) 13 | signal.Notify(c, syscall.SIGQUIT) 14 | } 15 | -------------------------------------------------------------------------------- /dynaml/merge.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "github.com/cloudfoundry-incubator/spiff/yaml" 5 | ) 6 | 7 | type MergeExpr struct { 8 | Path []string 9 | } 10 | 11 | func (e MergeExpr) Evaluate(binding Binding) (yaml.Node, bool) { 12 | return binding.FindInStubs(e.Path) 13 | } 14 | 15 | func (e MergeExpr) String() string { 16 | return "merge" 17 | } 18 | -------------------------------------------------------------------------------- /dynaml/boolean_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | ) 7 | 8 | var _ = Describe("booleans", func() { 9 | It("evaluates to a bool", func() { 10 | Expect(BooleanExpr{true}).To(EvaluateAs(true, FakeBinding{})) 11 | Expect(BooleanExpr{false}).To(EvaluateAs(false, FakeBinding{})) 12 | }) 13 | }) 14 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/types/code_location.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | type CodeLocation struct { 8 | FileName string 9 | LineNumber int 10 | FullStackTrace string 11 | } 12 | 13 | func (codeLocation CodeLocation) String() string { 14 | return fmt.Sprintf("%s:%d", codeLocation.FileName, codeLocation.LineNumber) 15 | } 16 | -------------------------------------------------------------------------------- /dynaml/expression.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "github.com/cloudfoundry-incubator/spiff/yaml" 5 | ) 6 | 7 | type Binding interface { 8 | FindFromRoot([]string) (yaml.Node, bool) 9 | FindReference([]string) (yaml.Node, bool) 10 | FindInStubs([]string) (yaml.Node, bool) 11 | } 12 | 13 | type Expression interface { 14 | Evaluate(Binding) (yaml.Node, bool) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor.go: -------------------------------------------------------------------------------- 1 | package remote 2 | 3 | /* 4 | The OutputInterceptor is used by the ForwardingReporter to 5 | intercept and capture all stdin and stderr output during a test run. 6 | */ 7 | type OutputInterceptor interface { 8 | StartInterceptingOutput() error 9 | StopInterceptingAndReturnOutput() (string, error) 10 | } 11 | -------------------------------------------------------------------------------- /dynaml/string.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/cloudfoundry-incubator/spiff/yaml" 7 | ) 8 | 9 | type StringExpr struct { 10 | Value string 11 | } 12 | 13 | func (e StringExpr) Evaluate(Binding) (yaml.Node, bool) { 14 | return node(e.Value), true 15 | } 16 | 17 | func (e StringExpr) String() string { 18 | return fmt.Sprintf("%q", e.Value) 19 | } 20 | -------------------------------------------------------------------------------- /dynaml/boolean.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/cloudfoundry-incubator/spiff/yaml" 7 | ) 8 | 9 | type BooleanExpr struct { 10 | Value bool 11 | } 12 | 13 | func (e BooleanExpr) Evaluate(Binding) (yaml.Node, bool) { 14 | return node(e.Value), true 15 | } 16 | 17 | func (e BooleanExpr) String() string { 18 | return fmt.Sprintf("%v", e.Value) 19 | } 20 | -------------------------------------------------------------------------------- /dynaml/integer.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "strconv" 5 | 6 | "github.com/cloudfoundry-incubator/spiff/yaml" 7 | ) 8 | 9 | type IntegerExpr struct { 10 | Value int64 11 | } 12 | 13 | func (e IntegerExpr) Evaluate(Binding) (yaml.Node, bool) { 14 | return node(e.Value), true 15 | } 16 | 17 | func (e IntegerExpr) String() string { 18 | return strconv.FormatInt(e.Value, 10) 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/types/omap.yaml: -------------------------------------------------------------------------------- 1 | # Explicitly typed ordered map (dictionary). 2 | Bestiary: !!omap 3 | - aardvark: African pig-like ant eater. Ugly. 4 | - anteater: South-American ant eater. Two species. 5 | - anaconda: South-American constrictor snake. Scaly. 6 | # Etc. 7 | # Flow style 8 | Numbers: !!omap [ one: 1, two: 2, three : 3 ] 9 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - 1.4 4 | 5 | install: 6 | - go get -v ./... 7 | - go get golang.org/x/tools/cmd/cover 8 | - go get github.com/onsi/gomega 9 | - go install github.com/onsi/ginkgo/ginkgo 10 | - export PATH=$PATH:$HOME/gopath/bin 11 | 12 | script: $HOME/gopath/bin/ginkgo -r --randomizeAllSpecs --failOnPending --randomizeSuites --race 13 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_23.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | not-date: !!str 2002-04-28 3 | 4 | picture: !!binary "\ 5 | R0lGODlhDAAMAIQAAP//9/X\ 6 | 17unp5WZmZgAAAOfn515eXv\ 7 | Pz7Y6OjuDg4J+fn5OTk6enp\ 8 | 56enmleECcgggoBADs=" 9 | 10 | application specific tag: !something | 11 | The semantics of the tag 12 | above may be different for 13 | different documents. 14 | 15 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/leafnodes/interfaces.go: -------------------------------------------------------------------------------- 1 | package leafnodes 2 | 3 | import ( 4 | "github.com/onsi/ginkgo/types" 5 | ) 6 | 7 | type BasicNode interface { 8 | Type() types.SpecComponentType 9 | Run() (types.SpecState, types.SpecFailure) 10 | CodeLocation() types.CodeLocation 11 | } 12 | 13 | type SubjectNode interface { 14 | BasicNode 15 | 16 | Text() string 17 | Flag() types.FlagType 18 | Samples() int 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_24.yaml: -------------------------------------------------------------------------------- 1 | %TAG ! tag:clarkevans.com,2002: 2 | --- !shape 3 | # Use the ! handle for presenting 4 | # tag:clarkevans.com,2002:circle 5 | - !circle 6 | center: &ORIGIN {x: 73, y: 129} 7 | radius: 7 8 | - !line 9 | start: *ORIGIN 10 | finish: { x: 89, y: 102 } 11 | - !label 12 | start: *ORIGIN 13 | color: 0xFFEEBB 14 | text: Pretty vector drawing. 15 | -------------------------------------------------------------------------------- /flow/cascade.go: -------------------------------------------------------------------------------- 1 | package flow 2 | 3 | import ( 4 | "github.com/cloudfoundry-incubator/spiff/yaml" 5 | ) 6 | 7 | func Cascade(template yaml.Node, templates ...yaml.Node) (yaml.Node, error) { 8 | for i := len(templates) - 1; i >= 0; i-- { 9 | flowed, err := Flow(templates[i], templates[i+1:]...) 10 | if err != nil { 11 | return nil, err 12 | } 13 | 14 | templates[i] = flowed 15 | } 16 | 17 | return Flow(template, templates...) 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/codegangsta/cli/autocomplete/bash_autocomplete: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | _cli_bash_autocomplete() { 4 | local cur prev opts base 5 | COMPREPLY=() 6 | cur="${COMP_WORDS[COMP_CWORD]}" 7 | prev="${COMP_WORDS[COMP_CWORD-1]}" 8 | opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion ) 9 | COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) 10 | return 0 11 | } 12 | 13 | complete -F _cli_bash_autocomplete $PROG -------------------------------------------------------------------------------- /flow/init_test.go: -------------------------------------------------------------------------------- 1 | package flow 2 | 3 | import ( 4 | "testing" 5 | 6 | . "github.com/onsi/ginkgo" 7 | . "github.com/onsi/gomega" 8 | 9 | "github.com/cloudfoundry-incubator/spiff/yaml" 10 | ) 11 | 12 | func Test(t *testing.T) { 13 | RegisterFailHandler(Fail) 14 | RunSpecs(t, "Flowing") 15 | } 16 | 17 | func parseYAML(source string) yaml.Node { 18 | parsed, err := yaml.Parse("test", []byte(source)) 19 | if err != nil { 20 | panic(err) 21 | } 22 | 23 | return parsed 24 | } 25 | -------------------------------------------------------------------------------- /scripts/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # vim: set ft=sh 3 | 4 | set -e -x -u 5 | 6 | #uses the local version of cover, if it is already checked out 7 | go get golang.org/x/tools/cmd/cover 8 | 9 | export GOPATH=$PWD/Godeps/_workspace:$GOPATH 10 | 11 | FIRST_GOPATH=`echo $GOPATH | cut -d':' -f1` 12 | 13 | mkdir -p $FIRST_GOPATH/bin 14 | export PATH=$FIRST_GOPATH/bin:$PATH 15 | 16 | go install github.com/onsi/ginkgo/ginkgo 17 | 18 | ginkgo -cover -r -failOnPending -randomizeAllSpecs -race "$@" 19 | -------------------------------------------------------------------------------- /dynaml/init_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "testing" 5 | 6 | . "github.com/onsi/ginkgo" 7 | . "github.com/onsi/gomega" 8 | 9 | "github.com/cloudfoundry-incubator/spiff/yaml" 10 | ) 11 | 12 | func Test(t *testing.T) { 13 | RegisterFailHandler(Fail) 14 | RunSpecs(t, "Dynaml") 15 | } 16 | 17 | func parseYAML(source string) yaml.Node { 18 | parsed, err := yaml.Parse("dynaml test", []byte(source)) 19 | if err != nil { 20 | panic(err) 21 | } 22 | 23 | return parsed 24 | } 25 | -------------------------------------------------------------------------------- /yaml/init_test.go: -------------------------------------------------------------------------------- 1 | package yaml 2 | 3 | import ( 4 | "testing" 5 | 6 | . "github.com/onsi/ginkgo" 7 | . "github.com/onsi/gomega" 8 | ) 9 | 10 | func Test(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "YAML parsing") 13 | } 14 | 15 | func parseYAML(source string) Node { 16 | parsed, err := Parse("test", []byte(source)) 17 | if err != nil { 18 | panic(err) 19 | } 20 | 21 | return parsed 22 | } 23 | 24 | func node(val interface{}) Node { 25 | return NewNode(val, "test") 26 | } 27 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | GODEPS := $(shell godep path) 2 | GOPATH := $(GODEPS):$(GOPATH) 3 | 4 | grammar: 5 | go get github.com/pointlander/peg 6 | peg dynaml/dynaml.peg 7 | 8 | release: spiff_linux_amd64.zip spiff_darwin_amd64.zip 9 | 10 | spiff_linux_amd64.zip: 11 | GOPATH=$(GOPATH) GOOS=linux GOARCH=amd64 go build -o spiff . 12 | zip spiff_linux_amd64.zip spiff 13 | rm spiff 14 | 15 | spiff_darwin_amd64.zip: 16 | GOPATH=$(GOPATH) GOOS=darwin GOARCH=amd64 go build -o spiff . 17 | zip spiff_darwin_amd64.zip spiff 18 | rm spiff 19 | -------------------------------------------------------------------------------- /vendor/github.com/codegangsta/cli/helpers_test.go: -------------------------------------------------------------------------------- 1 | package cli_test 2 | 3 | import ( 4 | "reflect" 5 | "testing" 6 | ) 7 | 8 | /* Test Helpers */ 9 | func expect(t *testing.T, a interface{}, b interface{}) { 10 | if a != b { 11 | t.Errorf("Expected %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a)) 12 | } 13 | } 14 | 15 | func refute(t *testing.T, a interface{}, b interface{}) { 16 | if a == b { 17 | t.Errorf("Did not expect %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a)) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/reporter.go: -------------------------------------------------------------------------------- 1 | package reporters 2 | 3 | import ( 4 | "github.com/onsi/ginkgo/config" 5 | "github.com/onsi/ginkgo/types" 6 | ) 7 | 8 | type Reporter interface { 9 | SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary) 10 | BeforeSuiteDidRun(setupSummary *types.SetupSummary) 11 | SpecWillRun(specSummary *types.SpecSummary) 12 | SpecDidComplete(specSummary *types.SpecSummary) 13 | AfterSuiteDidRun(setupSummary *types.SetupSummary) 14 | SpecSuiteDidEnd(summary *types.SuiteSummary) 15 | } 16 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/matcher_tests_suite_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | "testing" 5 | . "github.com/onsi/ginkgo" 6 | . "github.com/onsi/gomega" 7 | ) 8 | 9 | type myStringer struct { 10 | a string 11 | } 12 | 13 | func (s *myStringer) String() string { 14 | return s.a 15 | } 16 | 17 | type StringAlias string 18 | 19 | type myCustomType struct { 20 | s string 21 | n int 22 | f float32 23 | arr []string 24 | } 25 | 26 | func Test(t *testing.T) { 27 | RegisterFailHandler(Fail) 28 | RunSpecs(t, "Gomega") 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/version_command.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "github.com/onsi/ginkgo/config" 7 | ) 8 | 9 | func BuildVersionCommand() *Command { 10 | return &Command{ 11 | Name: "version", 12 | FlagSet: flag.NewFlagSet("version", flag.ExitOnError), 13 | UsageCommand: "ginkgo version", 14 | Usage: []string{ 15 | "Print Ginkgo's version", 16 | }, 17 | Command: printVersion, 18 | } 19 | } 20 | 21 | func printVersion([]string, []string) { 22 | fmt.Printf("Ginkgo Version %s\n", config.VERSION) 23 | } 24 | -------------------------------------------------------------------------------- /dynaml/or.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | 7 | "github.com/cloudfoundry-incubator/spiff/yaml" 8 | ) 9 | 10 | type OrExpr struct { 11 | A Expression 12 | B Expression 13 | } 14 | 15 | func (e OrExpr) Evaluate(binding Binding) (yaml.Node, bool) { 16 | a, ok := e.A.Evaluate(binding) 17 | if ok { 18 | if reflect.DeepEqual(a.Value(), e.A) { 19 | return nil, false 20 | } 21 | 22 | return a, true 23 | } 24 | 25 | return e.B.Evaluate(binding) 26 | } 27 | 28 | func (e OrExpr) String() string { 29 | return fmt.Sprintf("%s || %s", e.A, e.B) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_true_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | . "github.com/onsi/gomega/matchers" 7 | ) 8 | 9 | var _ = Describe("BeTrue", func() { 10 | It("should handle true and false correctly", func() { 11 | Ω(true).Should(BeTrue()) 12 | Ω(false).ShouldNot(BeTrue()) 13 | }) 14 | 15 | It("should only support booleans", func() { 16 | success, err := (&BeTrueMatcher{}).Match("foo") 17 | Ω(success).Should(BeFalse()) 18 | Ω(err).Should(HaveOccurred()) 19 | }) 20 | }) 21 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015-Present CloudFoundry.org Foundation, Inc. All Rights Reserved. 2 | 3 | This project contains software that is Copyright (c) 2013-2015 Pivotal Software, Inc. 4 | 5 | This project is licensed to you under the Apache License, Version 2.0 (the "License"). 6 | You may not use this project except in compliance with the License. 7 | 8 | This project may include a number of subcomponents with separate copyright notices 9 | and license terms. Your use of these subcomponents is subject to the terms and 10 | conditions of the subcomponent's license, as noted in the LICENSE file. 11 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/types/merge.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - &CENTER { x: 1, y: 2 } 3 | - &LEFT { x: 0, y: 2 } 4 | - &BIG { r: 10 } 5 | - &SMALL { r: 1 } 6 | 7 | # All the following maps are equal: 8 | 9 | - # Explicit keys 10 | x: 1 11 | y: 2 12 | r: 10 13 | label: center/big 14 | 15 | - # Merge one map 16 | << : *CENTER 17 | r: 10 18 | label: center/big 19 | 20 | - # Merge multiple maps 21 | << : [ *CENTER, *BIG ] 22 | label: center/big 23 | 24 | - # Override 25 | << : [ *BIG, *LEFT, *SMALL ] 26 | x: 1 27 | label: center/big 28 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_false_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | . "github.com/onsi/gomega/matchers" 7 | ) 8 | 9 | var _ = Describe("BeFalse", func() { 10 | It("should handle true and false correctly", func() { 11 | Ω(true).ShouldNot(BeFalse()) 12 | Ω(false).Should(BeFalse()) 13 | }) 14 | 15 | It("should only support booleans", func() { 16 | success, err := (&BeFalseMatcher{}).Match("foo") 17 | Ω(success).Should(BeFalse()) 18 | Ω(err).Should(HaveOccurred()) 19 | }) 20 | }) 21 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import "github.com/onsi/gomega/format" 4 | 5 | type BeNilMatcher struct { 6 | } 7 | 8 | func (matcher *BeNilMatcher) Match(actual interface{}) (success bool, err error) { 9 | return isNil(actual), nil 10 | } 11 | 12 | func (matcher *BeNilMatcher) FailureMessage(actual interface{}) (message string) { 13 | return format.Message(actual, "to be nil") 14 | } 15 | 16 | func (matcher *BeNilMatcher) NegatedFailureMessage(actual interface{}) (message string) { 17 | return format.Message(actual, "not to be nil") 18 | } 19 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/gexec/gexec_suite_test.go: -------------------------------------------------------------------------------- 1 | package gexec_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | "github.com/onsi/gomega/gexec" 7 | 8 | "testing" 9 | ) 10 | 11 | var fireflyPath string 12 | 13 | func TestGexec(t *testing.T) { 14 | BeforeSuite(func() { 15 | var err error 16 | fireflyPath, err = gexec.Build("./_fixture/firefly") 17 | Ω(err).ShouldNot(HaveOccurred()) 18 | }) 19 | 20 | AfterSuite(func() { 21 | gexec.CleanupBuildArtifacts() 22 | }) 23 | 24 | RegisterFailHandler(Fail) 25 | RunSpecs(t, "Gexec Suite") 26 | } 27 | -------------------------------------------------------------------------------- /compare/init_test.go: -------------------------------------------------------------------------------- 1 | package compare 2 | 3 | import ( 4 | "testing" 5 | 6 | . "github.com/onsi/ginkgo" 7 | . "github.com/onsi/gomega" 8 | 9 | "github.com/cloudfoundry-incubator/spiff/yaml" 10 | ) 11 | 12 | func Test(t *testing.T) { 13 | RegisterFailHandler(Fail) 14 | RunSpecs(t, "Diffing") 15 | } 16 | 17 | func parseYAML(source string) yaml.Node { 18 | return parseYAMLFrom(source, "compare test") 19 | } 20 | 21 | func parseYAMLFrom(source string, name string) yaml.Node { 22 | parsed, err := yaml.Parse(name, []byte(source)) 23 | if err != nil { 24 | panic(err) 25 | } 26 | 27 | return parsed 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/remote/fake_output_interceptor_test.go: -------------------------------------------------------------------------------- 1 | package remote_test 2 | 3 | type fakeOutputInterceptor struct { 4 | DidStartInterceptingOutput bool 5 | DidStopInterceptingOutput bool 6 | InterceptedOutput string 7 | } 8 | 9 | func (interceptor *fakeOutputInterceptor) StartInterceptingOutput() error { 10 | interceptor.DidStartInterceptingOutput = true 11 | return nil 12 | } 13 | 14 | func (interceptor *fakeOutputInterceptor) StopInterceptingAndReturnOutput() (string, error) { 15 | interceptor.DidStopInterceptingOutput = true 16 | return interceptor.InterceptedOutput, nil 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_28.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | Time: 2001-11-23 15:01:42 -5 3 | User: ed 4 | Warning: 5 | This is an error message 6 | for the log file 7 | --- 8 | Time: 2001-11-23 15:02:31 -5 9 | User: ed 10 | Warning: 11 | A slightly different error 12 | message. 13 | --- 14 | Date: 2001-11-23 15:03:17 -5 15 | User: ed 16 | Fatal: 17 | Unknown variable "bar" 18 | Stack: 19 | - file: TopClass.py 20 | line: 23 21 | code: | 22 | x = MoreObject("345\n") 23 | - file: MoreClass.py 24 | line: 58 25 | code: |- 26 | foo = bar 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_27_dumped.yaml: -------------------------------------------------------------------------------- 1 | !!org.yaml.snakeyaml.Invoice 2 | billTo: &id001 3 | address: 4 | city: Royal Oak 5 | lines: | 6 | 458 Walkman Dr. 7 | Suite #292 8 | postal: '48046' 9 | state: MI 10 | family: Dumars 11 | given: Chris 12 | comments: Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338. 13 | date: '2001-01-23' 14 | invoice: 34843 15 | product: 16 | - {description: Basketball, price: 450.0, quantity: 4, sku: BL394D} 17 | - {description: Super Hoop, price: 2392.0, quantity: 1, sku: BL4438H} 18 | shipTo: *id001 19 | tax: 251.42 20 | total: 4443.52 -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/types/seq.yaml: -------------------------------------------------------------------------------- 1 | # Ordered sequence of nodes 2 | Block style: !!seq 3 | - Mercury # Rotates - no light/dark sides. 4 | - Venus # Deadliest. Aptly named. 5 | - Earth # Mostly dirt. 6 | - Mars # Seems empty. 7 | - Jupiter # The king. 8 | - Saturn # Pretty. 9 | - Uranus # Where the sun hardly shines. 10 | - Neptune # Boring. No rings. 11 | - Pluto # You call this a planet? 12 | Flow style: !!seq [ Mercury, Venus, Earth, Mars, # Rocks 13 | Jupiter, Saturn, Uranus, Neptune, # Gas 14 | Pluto ] # Overrated 15 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/watch/delta.go: -------------------------------------------------------------------------------- 1 | package watch 2 | 3 | import "sort" 4 | 5 | type Delta struct { 6 | ModifiedPackages []string 7 | 8 | NewSuites []*Suite 9 | RemovedSuites []*Suite 10 | modifiedSuites []*Suite 11 | } 12 | 13 | type DescendingByDelta []*Suite 14 | 15 | func (a DescendingByDelta) Len() int { return len(a) } 16 | func (a DescendingByDelta) Swap(i, j int) { a[i], a[j] = a[j], a[i] } 17 | func (a DescendingByDelta) Less(i, j int) bool { return a[i].Delta() > a[j].Delta() } 18 | 19 | func (d Delta) ModifiedSuites() []*Suite { 20 | sort.Sort(DescendingByDelta(d.modifiedSuites)) 21 | return d.modifiedSuites 22 | } 23 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/types/types.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | type GomegaFailHandler func(message string, callerSkip ...int) 4 | 5 | //A simple *testing.T interface wrapper 6 | type GomegaTestingT interface { 7 | Errorf(format string, args ...interface{}) 8 | } 9 | 10 | //All Gomega matchers must implement the GomegaMatcher interface 11 | // 12 | //For details on writing custom matchers, check out: http://onsi.github.io/gomega/#adding_your_own_matchers 13 | type GomegaMatcher interface { 14 | Match(actual interface{}) (success bool, err error) 15 | FailureMessage(actual interface{}) (message string) 16 | NegatedFailureMessage(actual interface{}) (message string) 17 | } 18 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/types/synchronization.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | import ( 4 | "encoding/json" 5 | ) 6 | 7 | type RemoteBeforeSuiteState int 8 | 9 | const ( 10 | RemoteBeforeSuiteStateInvalid RemoteBeforeSuiteState = iota 11 | 12 | RemoteBeforeSuiteStatePending 13 | RemoteBeforeSuiteStatePassed 14 | RemoteBeforeSuiteStateFailed 15 | RemoteBeforeSuiteStateDisappeared 16 | ) 17 | 18 | type RemoteBeforeSuiteData struct { 19 | Data []byte 20 | State RemoteBeforeSuiteState 21 | } 22 | 23 | func (r RemoteBeforeSuiteData) ToJSON() []byte { 24 | data, _ := json.Marshal(r) 25 | return data 26 | } 27 | 28 | type RemoteAfterSuiteData struct { 29 | CanRun bool 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/internal/fakematcher/fake_matcher.go: -------------------------------------------------------------------------------- 1 | package fakematcher 2 | 3 | import "fmt" 4 | 5 | type FakeMatcher struct { 6 | ReceivedActual interface{} 7 | MatchesToReturn bool 8 | ErrToReturn error 9 | } 10 | 11 | func (matcher *FakeMatcher) Match(actual interface{}) (bool, error) { 12 | matcher.ReceivedActual = actual 13 | 14 | return matcher.MatchesToReturn, matcher.ErrToReturn 15 | } 16 | 17 | func (matcher *FakeMatcher) FailureMessage(actual interface{}) string { 18 | return fmt.Sprintf("positive: %v", actual) 19 | } 20 | 21 | func (matcher *FakeMatcher) NegatedFailureMessage(actual interface{}) string { 22 | return fmt.Sprintf("negative: %v", actual) 23 | } 24 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/testrunner/run_result.go: -------------------------------------------------------------------------------- 1 | package testrunner 2 | 3 | type RunResult struct { 4 | Passed bool 5 | HasProgrammaticFocus bool 6 | } 7 | 8 | func PassingRunResult() RunResult { 9 | return RunResult{ 10 | Passed: true, 11 | HasProgrammaticFocus: false, 12 | } 13 | } 14 | 15 | func FailingRunResult() RunResult { 16 | return RunResult{ 17 | Passed: false, 18 | HasProgrammaticFocus: false, 19 | } 20 | } 21 | 22 | func (r RunResult) Merge(o RunResult) RunResult { 23 | return RunResult{ 24 | Passed: r.Passed && o.Passed, 25 | HasProgrammaticFocus: r.HasProgrammaticFocus || o.HasProgrammaticFocus, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/codegangsta/cli/cli.go: -------------------------------------------------------------------------------- 1 | // Package cli provides a minimal framework for creating and organizing command line 2 | // Go applications. cli is designed to be easy to understand and write, the most simple 3 | // cli application can be written as follows: 4 | // func main() { 5 | // cli.NewApp().Run(os.Args) 6 | // } 7 | // 8 | // Of course this application does not do much, so let's make this an actual application: 9 | // func main() { 10 | // app := cli.NewApp() 11 | // app.Name = "greet" 12 | // app.Usage = "say a greeting" 13 | // app.Action = func(c *cli.Context) { 14 | // println("Greetings") 15 | // } 16 | // 17 | // app.Run(os.Args) 18 | // } 19 | package cli 20 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_nil_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | ) 7 | 8 | var _ = Describe("BeNil", func() { 9 | It("should succeed when passed nil", func() { 10 | Ω(nil).Should(BeNil()) 11 | }) 12 | 13 | It("should succeed when passed a typed nil", func() { 14 | var a []int 15 | Ω(a).Should(BeNil()) 16 | }) 17 | 18 | It("should succeed when passing nil pointer", func() { 19 | var f *struct{} 20 | Ω(f).Should(BeNil()) 21 | }) 22 | 23 | It("should not succeed when not passed nil", func() { 24 | Ω(0).ShouldNot(BeNil()) 25 | Ω(false).ShouldNot(BeNil()) 26 | Ω("").ShouldNot(BeNil()) 27 | }) 28 | }) 29 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/suite/suite_suite_test.go: -------------------------------------------------------------------------------- 1 | package suite_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "testing" 8 | ) 9 | 10 | func Test(t *testing.T) { 11 | RegisterFailHandler(Fail) 12 | RunSpecs(t, "Suite") 13 | } 14 | 15 | var numBeforeSuiteRuns = 0 16 | var numAfterSuiteRuns = 0 17 | 18 | var _ = BeforeSuite(func() { 19 | numBeforeSuiteRuns++ 20 | }) 21 | 22 | var _ = AfterSuite(func() { 23 | numAfterSuiteRuns++ 24 | Ω(numBeforeSuiteRuns).Should(Equal(1)) 25 | Ω(numAfterSuiteRuns).Should(Equal(1)) 26 | }) 27 | 28 | //Fakes 29 | type fakeTestingT struct { 30 | didFail bool 31 | } 32 | 33 | func (fakeT *fakeTestingT) Fail() { 34 | fakeT.didFail = true 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_true_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | ) 7 | 8 | type BeTrueMatcher struct { 9 | } 10 | 11 | func (matcher *BeTrueMatcher) Match(actual interface{}) (success bool, err error) { 12 | if !isBool(actual) { 13 | return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1)) 14 | } 15 | 16 | return actual.(bool), nil 17 | } 18 | 19 | func (matcher *BeTrueMatcher) FailureMessage(actual interface{}) (message string) { 20 | return format.Message(actual, "to be true") 21 | } 22 | 23 | func (matcher *BeTrueMatcher) NegatedFailureMessage(actual interface{}) (message string) { 24 | return format.Message(actual, "not to be true") 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_false_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | ) 7 | 8 | type BeFalseMatcher struct { 9 | } 10 | 11 | func (matcher *BeFalseMatcher) Match(actual interface{}) (success bool, err error) { 12 | if !isBool(actual) { 13 | return false, fmt.Errorf("Expected a boolean. Got:\n%s", format.Object(actual, 1)) 14 | } 15 | 16 | return actual == false, nil 17 | } 18 | 19 | func (matcher *BeFalseMatcher) FailureMessage(actual interface{}) (message string) { 20 | return format.Message(actual, "to be false") 21 | } 22 | 23 | func (matcher *BeFalseMatcher) NegatedFailureMessage(actual interface{}) (message string) { 24 | return format.Message(actual, "not to be false") 25 | } 26 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/remote/fake_poster_test.go: -------------------------------------------------------------------------------- 1 | package remote_test 2 | 3 | import ( 4 | "io" 5 | "io/ioutil" 6 | "net/http" 7 | ) 8 | 9 | type post struct { 10 | url string 11 | bodyType string 12 | bodyContent []byte 13 | } 14 | 15 | type fakePoster struct { 16 | posts []post 17 | } 18 | 19 | func newFakePoster() *fakePoster { 20 | return &fakePoster{ 21 | posts: make([]post, 0), 22 | } 23 | } 24 | 25 | func (poster *fakePoster) Post(url string, bodyType string, body io.Reader) (resp *http.Response, err error) { 26 | bodyContent, _ := ioutil.ReadAll(body) 27 | poster.posts = append(poster.posts, post{ 28 | url: url, 29 | bodyType: bodyType, 30 | bodyContent: bodyContent, 31 | }) 32 | return nil, nil 33 | } 34 | -------------------------------------------------------------------------------- /dynaml/list.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | 7 | "github.com/cloudfoundry-incubator/spiff/yaml" 8 | ) 9 | 10 | type ListExpr struct { 11 | Contents []Expression 12 | } 13 | 14 | func (e ListExpr) Evaluate(binding Binding) (yaml.Node, bool) { 15 | nodes := []yaml.Node{} 16 | 17 | for _, c := range e.Contents { 18 | result, ok := c.Evaluate(binding) 19 | if !ok { 20 | return nil, false 21 | } 22 | 23 | nodes = append(nodes, result) 24 | } 25 | 26 | return node(nodes), true 27 | } 28 | 29 | func (e ListExpr) String() string { 30 | vals := make([]string, len(e.Contents)) 31 | for i, e := range e.Contents { 32 | vals[i] = fmt.Sprintf("%s", e) 33 | } 34 | 35 | return fmt.Sprintf("[%s]", strings.Join(vals, ", ")) 36 | } 37 | -------------------------------------------------------------------------------- /dynaml/addition.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/cloudfoundry-incubator/spiff/yaml" 7 | ) 8 | 9 | type AdditionExpr struct { 10 | A Expression 11 | B Expression 12 | } 13 | 14 | func (e AdditionExpr) Evaluate(binding Binding) (yaml.Node, bool) { 15 | a, ok := e.A.Evaluate(binding) 16 | if !ok { 17 | return nil, false 18 | } 19 | 20 | b, ok := e.B.Evaluate(binding) 21 | if !ok { 22 | return nil, false 23 | } 24 | 25 | aint, ok := a.Value().(int64) 26 | if !ok { 27 | return nil, false 28 | } 29 | 30 | bint, ok := b.Value().(int64) 31 | if !ok { 32 | return nil, false 33 | } 34 | 35 | return node(aint + bint), true 36 | } 37 | 38 | func (e AdditionExpr) String() string { 39 | return fmt.Sprintf("%s + %s", e.A, e.B) 40 | } 41 | -------------------------------------------------------------------------------- /dynaml/subtraction.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/cloudfoundry-incubator/spiff/yaml" 7 | ) 8 | 9 | type SubtractionExpr struct { 10 | A Expression 11 | B Expression 12 | } 13 | 14 | func (e SubtractionExpr) Evaluate(binding Binding) (yaml.Node, bool) { 15 | a, ok := e.A.Evaluate(binding) 16 | if !ok { 17 | return nil, false 18 | } 19 | 20 | b, ok := e.B.Evaluate(binding) 21 | if !ok { 22 | return nil, false 23 | } 24 | 25 | aint, ok := a.Value().(int64) 26 | if !ok { 27 | return nil, false 28 | } 29 | 30 | bint, ok := b.Value().(int64) 31 | if !ok { 32 | return nil, false 33 | } 34 | 35 | return node(aint - bint), true 36 | } 37 | 38 | func (e SubtractionExpr) String() string { 39 | return fmt.Sprintf("%s - %s", e.A, e.B) 40 | } 41 | -------------------------------------------------------------------------------- /init_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "testing" 5 | 6 | . "github.com/onsi/ginkgo" 7 | . "github.com/onsi/gomega" 8 | "github.com/onsi/gomega/gexec" 9 | 10 | "github.com/cloudfoundry-incubator/spiff/yaml" 11 | ) 12 | 13 | var spiff string 14 | 15 | func Test(t *testing.T) { 16 | BeforeSuite(func() { 17 | var err error 18 | spiff, err = gexec.Build("github.com/cloudfoundry-incubator/spiff") 19 | Ω(err).ShouldNot(HaveOccurred()) 20 | }) 21 | 22 | AfterSuite(func() { 23 | gexec.CleanupBuildArtifacts() 24 | }) 25 | 26 | RegisterFailHandler(Fail) 27 | RunSpecs(t, "Executable") 28 | } 29 | 30 | func parseYAML(source string) yaml.Node { 31 | parsed, err := yaml.Parse("test", []byte(source)) 32 | if err != nil { 33 | panic(err) 34 | } 35 | 36 | return parsed 37 | } 38 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_zero_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "github.com/onsi/gomega/format" 5 | "reflect" 6 | ) 7 | 8 | type BeZeroMatcher struct { 9 | } 10 | 11 | func (matcher *BeZeroMatcher) Match(actual interface{}) (success bool, err error) { 12 | if actual == nil { 13 | return true, nil 14 | } 15 | zeroValue := reflect.Zero(reflect.TypeOf(actual)).Interface() 16 | 17 | return reflect.DeepEqual(zeroValue, actual), nil 18 | 19 | } 20 | 21 | func (matcher *BeZeroMatcher) FailureMessage(actual interface{}) (message string) { 22 | return format.Message(actual, "to be zero-valued") 23 | } 24 | 25 | func (matcher *BeZeroMatcher) NegatedFailureMessage(actual interface{}) (message string) { 26 | return format.Message(actual, "not to be zero-valued") 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_win.go: -------------------------------------------------------------------------------- 1 | // +build windows 2 | 3 | package remote 4 | 5 | import ( 6 | "errors" 7 | ) 8 | 9 | func NewOutputInterceptor() OutputInterceptor { 10 | return &outputInterceptor{} 11 | } 12 | 13 | type outputInterceptor struct { 14 | intercepting bool 15 | } 16 | 17 | func (interceptor *outputInterceptor) StartInterceptingOutput() error { 18 | if interceptor.intercepting { 19 | return errors.New("Already intercepting output!") 20 | } 21 | interceptor.intercepting = true 22 | 23 | // not working on windows... 24 | 25 | return nil 26 | } 27 | 28 | func (interceptor *outputInterceptor) StopInterceptingAndReturnOutput() (string, error) { 29 | // not working on windows... 30 | interceptor.intercepting = false 31 | 32 | return "", nil 33 | } 34 | -------------------------------------------------------------------------------- /dynaml/fake_binding_helper_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/cloudfoundry-incubator/spiff/yaml" 7 | ) 8 | 9 | type FakeBinding struct { 10 | FoundFromRoot map[string]yaml.Node 11 | FoundReferences map[string]yaml.Node 12 | FoundInStubs map[string]yaml.Node 13 | } 14 | 15 | func (c FakeBinding) FindFromRoot(path []string) (yaml.Node, bool) { 16 | val, found := c.FoundFromRoot[strings.Join(path, ".")] 17 | return val, found 18 | } 19 | 20 | func (c FakeBinding) FindReference(path []string) (yaml.Node, bool) { 21 | val, found := c.FoundReferences[strings.Join(path, ".")] 22 | return val, found 23 | } 24 | 25 | func (c FakeBinding) FindInStubs(path []string) (yaml.Node, bool) { 26 | val, found := c.FoundInStubs[strings.Join(path, ".")] 27 | return val, found 28 | } 29 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/yaml_definesh.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | */ 14 | 15 | package candiedyaml 16 | 17 | const ( 18 | yaml_VERSION_MAJOR = 0 19 | yaml_VERSION_MINOR = 1 20 | yaml_VERSION_PATCH = 6 21 | yaml_VERSION_STRING = "0.1.6" 22 | ) 23 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/help_command.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | ) 7 | 8 | func BuildHelpCommand() *Command { 9 | return &Command{ 10 | Name: "help", 11 | FlagSet: flag.NewFlagSet("help", flag.ExitOnError), 12 | UsageCommand: "ginkgo help ", 13 | Usage: []string{ 14 | "Print usage information. If a command is passed in, print usage information just for that command.", 15 | }, 16 | Command: printHelp, 17 | } 18 | } 19 | 20 | func printHelp(args []string, additionalArgs []string) { 21 | if len(args) == 0 { 22 | usage() 23 | } else { 24 | command, found := commandMatching(args[0]) 25 | if !found { 26 | complainAndQuit(fmt.Sprintf("Unknown command: %s", args[0])) 27 | } 28 | 29 | usageForCommand(command, true) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | ) 7 | 8 | type BeEmptyMatcher struct { 9 | } 10 | 11 | func (matcher *BeEmptyMatcher) Match(actual interface{}) (success bool, err error) { 12 | length, ok := lengthOf(actual) 13 | if !ok { 14 | return false, fmt.Errorf("BeEmpty matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) 15 | } 16 | 17 | return length == 0, nil 18 | } 19 | 20 | func (matcher *BeEmptyMatcher) FailureMessage(actual interface{}) (message string) { 21 | return format.Message(actual, "to be empty") 22 | } 23 | 24 | func (matcher *BeEmptyMatcher) NegatedFailureMessage(actual interface{}) (message string) { 25 | return format.Message(actual, "not to be empty") 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_zero_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | ) 7 | 8 | var _ = Describe("BeZero", func() { 9 | It("should succeed if the passed in object is the zero value for its type", func() { 10 | Ω(nil).Should(BeZero()) 11 | 12 | Ω("").Should(BeZero()) 13 | Ω(" ").ShouldNot(BeZero()) 14 | 15 | Ω(0).Should(BeZero()) 16 | Ω(1).ShouldNot(BeZero()) 17 | 18 | Ω(0.0).Should(BeZero()) 19 | Ω(0.1).ShouldNot(BeZero()) 20 | 21 | // Ω([]int{}).Should(BeZero()) 22 | Ω([]int{1}).ShouldNot(BeZero()) 23 | 24 | // Ω(map[string]int{}).Should(BeZero()) 25 | Ω(map[string]int{"a": 1}).ShouldNot(BeZero()) 26 | 27 | Ω(myCustomType{}).Should(BeZero()) 28 | Ω(myCustomType{s: "a"}).ShouldNot(BeZero()) 29 | }) 30 | }) 31 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_occurred_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | "errors" 5 | . "github.com/onsi/ginkgo" 6 | . "github.com/onsi/gomega" 7 | . "github.com/onsi/gomega/matchers" 8 | ) 9 | 10 | var _ = Describe("HaveOccurred", func() { 11 | It("should succeed if matching an error", func() { 12 | Ω(errors.New("Foo")).Should(HaveOccurred()) 13 | }) 14 | 15 | It("should not succeed with nil", func() { 16 | Ω(nil).ShouldNot(HaveOccurred()) 17 | }) 18 | 19 | It("should only support errors and nil", func() { 20 | success, err := (&HaveOccurredMatcher{}).Match("foo") 21 | Ω(success).Should(BeFalse()) 22 | Ω(err).Should(HaveOccurred()) 23 | 24 | success, err = (&HaveOccurredMatcher{}).Match("") 25 | Ω(success).Should(BeFalse()) 26 | Ω(err).Should(HaveOccurred()) 27 | }) 28 | }) 29 | -------------------------------------------------------------------------------- /dynaml/reference.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/cloudfoundry-incubator/spiff/yaml" 7 | ) 8 | 9 | type ReferenceExpr struct { 10 | Path []string 11 | } 12 | 13 | func (e ReferenceExpr) Evaluate(binding Binding) (yaml.Node, bool) { 14 | var step yaml.Node 15 | var ok bool 16 | 17 | fromRoot := e.Path[0] == "" 18 | 19 | for i := 0; i < len(e.Path); i++ { 20 | if fromRoot { 21 | step, ok = binding.FindFromRoot(e.Path[1 : i+1]) 22 | } else { 23 | step, ok = binding.FindReference(e.Path[:i+1]) 24 | } 25 | 26 | if !ok { 27 | return nil, false 28 | } 29 | 30 | switch step.Value().(type) { 31 | case Expression: 32 | return node(e), true 33 | } 34 | } 35 | 36 | return step, true 37 | } 38 | 39 | func (e ReferenceExpr) String() string { 40 | return strings.Join(e.Path, ".") 41 | } 42 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/fixtures/specification/example2_27.yaml: -------------------------------------------------------------------------------- 1 | --- ! 2 | invoice: 34843 3 | date : 2001-01-23 4 | billTo: &id001 5 | given : Chris 6 | family : Dumars 7 | address: 8 | lines: | 9 | 458 Walkman Dr. 10 | Suite #292 11 | city : Royal Oak 12 | state : MI 13 | postal : 48046 14 | shipTo: *id001 15 | product: 16 | - sku : BL394D 17 | quantity : 4 18 | description : Basketball 19 | price : 450.00 20 | - sku : BL4438H 21 | quantity : 1 22 | description : Super Hoop 23 | price : 2392.00 24 | tax : 251.42 25 | total: 4443.52 26 | comments: 27 | Late afternoon is best. 28 | Backup contact is Nancy 29 | Billsmer @ 338-4338. 30 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/equal_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | "reflect" 7 | ) 8 | 9 | type EqualMatcher struct { 10 | Expected interface{} 11 | } 12 | 13 | func (matcher *EqualMatcher) Match(actual interface{}) (success bool, err error) { 14 | if actual == nil && matcher.Expected == nil { 15 | return false, fmt.Errorf("Refusing to compare to .") 16 | } 17 | return reflect.DeepEqual(actual, matcher.Expected), nil 18 | } 19 | 20 | func (matcher *EqualMatcher) FailureMessage(actual interface{}) (message string) { 21 | return format.Message(actual, "to equal", matcher.Expected) 22 | } 23 | 24 | func (matcher *EqualMatcher) NegatedFailureMessage(actual interface{}) (message string) { 25 | return format.Message(actual, "not to equal", matcher.Expected) 26 | } 27 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/leafnodes/it_node_test.go: -------------------------------------------------------------------------------- 1 | package leafnodes_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/ginkgo/internal/leafnodes" 6 | . "github.com/onsi/gomega" 7 | 8 | "github.com/onsi/ginkgo/internal/codelocation" 9 | "github.com/onsi/ginkgo/types" 10 | ) 11 | 12 | var _ = Describe("It Nodes", func() { 13 | It("should report the correct type, text, flag, and code location", func() { 14 | codeLocation := codelocation.New(0) 15 | it := NewItNode("my it node", func() {}, types.FlagTypeFocused, codeLocation, 0, nil, 3) 16 | Ω(it.Type()).Should(Equal(types.SpecComponentTypeIt)) 17 | Ω(it.Flag()).Should(Equal(types.FlagTypeFocused)) 18 | Ω(it.Text()).Should(Equal("my it node")) 19 | Ω(it.CodeLocation()).Should(Equal(codeLocation)) 20 | Ω(it.Samples()).Should(Equal(1)) 21 | }) 22 | }) 23 | -------------------------------------------------------------------------------- /dynaml/addition_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | ) 7 | 8 | var _ = Describe("addition", func() { 9 | It("adds both numbers", func() { 10 | expr := AdditionExpr{ 11 | IntegerExpr{2}, 12 | IntegerExpr{3}, 13 | } 14 | 15 | Expect(expr).To(EvaluateAs(5, FakeBinding{})) 16 | }) 17 | 18 | Context("when the left-hand side is not an integer", func() { 19 | It("fails", func() { 20 | expr := AdditionExpr{ 21 | StringExpr{"lol"}, 22 | IntegerExpr{2}, 23 | } 24 | 25 | Expect(expr).To(FailToEvaluate(FakeBinding{})) 26 | }) 27 | }) 28 | 29 | Context("when the right-hand side is not an integer", func() { 30 | It("fails", func() { 31 | expr := AdditionExpr{ 32 | IntegerExpr{2}, 33 | StringExpr{"lol"}, 34 | } 35 | 36 | Expect(expr).To(FailToEvaluate(FakeBinding{})) 37 | }) 38 | }) 39 | }) 40 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/integration/tags_test.go: -------------------------------------------------------------------------------- 1 | package integration_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | "github.com/onsi/gomega/gexec" 7 | ) 8 | 9 | var _ = Describe("Tags", func() { 10 | var pathToTest string 11 | BeforeEach(func() { 12 | pathToTest = tmpPath("tags") 13 | copyIn("tags_tests", pathToTest) 14 | }) 15 | 16 | It("should honor the passed in -tags flag", func() { 17 | session := startGinkgo(pathToTest, "--noColor") 18 | Eventually(session).Should(gexec.Exit(0)) 19 | output := string(session.Out.Contents()) 20 | Ω(output).Should(ContainSubstring("Ran 1 of 1 Specs")) 21 | 22 | session = startGinkgo(pathToTest, "--noColor", "-tags=complex_tests") 23 | Eventually(session).Should(gexec.Exit(0)) 24 | output = string(session.Out.Contents()) 25 | Ω(output).Should(ContainSubstring("Ran 3 of 3 Specs")) 26 | }) 27 | }) 28 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/candiedyaml_suite_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | */ 14 | 15 | package candiedyaml 16 | 17 | import ( 18 | . "github.com/onsi/ginkgo" 19 | . "github.com/onsi/gomega" 20 | 21 | "testing" 22 | ) 23 | 24 | func TestCandiedyaml(t *testing.T) { 25 | RegisterFailHandler(Fail) 26 | RunSpecs(t, "Candiedyaml Suite") 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/README.md: -------------------------------------------------------------------------------- 1 | ![Gomega: Ginkgo's Preferred Matcher Library](http://onsi.github.io/gomega/images/gomega.png) 2 | 3 | [![Build Status](https://travis-ci.org/onsi/gomega.png)](https://travis-ci.org/onsi/gomega) 4 | 5 | Jump straight to the [docs](http://onsi.github.io/gomega/) to learn about Gomega, including a list of [all available matchers](http://onsi.github.io/gomega/#provided-matchers). 6 | 7 | To discuss Gomega and get updates, join the [google group](https://groups.google.com/d/forum/ginkgo-and-gomega). 8 | 9 | ## [Ginkgo](http://github.com/onsi/ginkgo): a BDD Testing Framework for Golang 10 | 11 | Learn more about Ginkgo [here](http://onsi.github.io/ginkgo/) 12 | 13 | ## License 14 | 15 | Gomega is MIT-Licensed 16 | 17 | The `ConsistOf` matcher uses [goraph](https://github.com/amitkgupta/goraph) which is embedded in the source to simplify distribution. goraph has an MIT license. 18 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/succeed_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/onsi/gomega/format" 7 | ) 8 | 9 | type SucceedMatcher struct { 10 | } 11 | 12 | func (matcher *SucceedMatcher) Match(actual interface{}) (success bool, err error) { 13 | if actual == nil { 14 | return true, nil 15 | } 16 | 17 | if isError(actual) { 18 | return false, nil 19 | } 20 | 21 | return false, fmt.Errorf("Expected an error-type. Got:\n%s", format.Object(actual, 1)) 22 | } 23 | 24 | func (matcher *SucceedMatcher) FailureMessage(actual interface{}) (message string) { 25 | return fmt.Sprintf("Expected success, but got an error:\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1)) 26 | } 27 | 28 | func (matcher *SucceedMatcher) NegatedFailureMessage(actual interface{}) (message string) { 29 | return "Expected failure, but got no error." 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/writer/fake_writer.go: -------------------------------------------------------------------------------- 1 | package writer 2 | 3 | type FakeGinkgoWriter struct { 4 | EventStream []string 5 | } 6 | 7 | func NewFake() *FakeGinkgoWriter { 8 | return &FakeGinkgoWriter{ 9 | EventStream: []string{}, 10 | } 11 | } 12 | 13 | func (writer *FakeGinkgoWriter) AddEvent(event string) { 14 | writer.EventStream = append(writer.EventStream, event) 15 | } 16 | 17 | func (writer *FakeGinkgoWriter) Truncate() { 18 | writer.EventStream = append(writer.EventStream, "TRUNCATE") 19 | } 20 | 21 | func (writer *FakeGinkgoWriter) DumpOut() { 22 | writer.EventStream = append(writer.EventStream, "DUMP") 23 | } 24 | 25 | func (writer *FakeGinkgoWriter) DumpOutWithHeader(header string) { 26 | writer.EventStream = append(writer.EventStream, "DUMP_WITH_HEADER: "+header) 27 | } 28 | 29 | func (writer *FakeGinkgoWriter) Write(data []byte) (n int, err error) { 30 | return 0, nil 31 | } 32 | -------------------------------------------------------------------------------- /dynaml/subtraction_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | ) 7 | 8 | var _ = Describe("subtraction", func() { 9 | It("subtracts both numbers", func() { 10 | expr := SubtractionExpr{ 11 | IntegerExpr{7}, 12 | IntegerExpr{3}, 13 | } 14 | 15 | Expect(expr).To(EvaluateAs(4, FakeBinding{})) 16 | }) 17 | 18 | Context("when the left-hand side is not an integer", func() { 19 | It("fails", func() { 20 | expr := SubtractionExpr{ 21 | StringExpr{"lol"}, 22 | IntegerExpr{2}, 23 | } 24 | 25 | Expect(expr).To(FailToEvaluate(FakeBinding{})) 26 | }) 27 | }) 28 | 29 | Context("when the right-hand side is not an integer", func() { 30 | It("fails", func() { 31 | expr := SubtractionExpr{ 32 | IntegerExpr{2}, 33 | StringExpr{"lol"}, 34 | } 35 | 36 | Expect(expr).To(FailToEvaluate(FakeBinding{})) 37 | }) 38 | }) 39 | }) 40 | -------------------------------------------------------------------------------- /dynaml/fail_to_evaluate_helper_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | func FailToEvaluate(binding Binding) *FailToEvaluateMatcher { 8 | return &FailToEvaluateMatcher{binding} 9 | } 10 | 11 | type FailToEvaluateMatcher struct { 12 | Binding Binding 13 | } 14 | 15 | func (matcher *FailToEvaluateMatcher) Match(source interface{}) (success bool, err error) { 16 | expr, ok := source.(Expression) 17 | if !ok { 18 | return false, fmt.Errorf("Not an expression: %v", source) 19 | } 20 | 21 | actual, ok := expr.Evaluate(matcher.Binding) 22 | if ok { 23 | return false, fmt.Errorf("Node evaluated to: %#v", actual) 24 | } 25 | 26 | return true, nil 27 | } 28 | 29 | func (matcher *FailToEvaluateMatcher) FailureMessage(actual interface{}) (message string) { 30 | return "" 31 | } 32 | 33 | func (matcher *FailToEvaluateMatcher) NegatedFailureMessage(actual interface{}) (message string) { 34 | return "" 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_len_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | ) 7 | 8 | type HaveLenMatcher struct { 9 | Count int 10 | } 11 | 12 | func (matcher *HaveLenMatcher) Match(actual interface{}) (success bool, err error) { 13 | length, ok := lengthOf(actual) 14 | if !ok { 15 | return false, fmt.Errorf("HaveLen matcher expects a string/array/map/channel/slice. Got:\n%s", format.Object(actual, 1)) 16 | } 17 | 18 | return length == matcher.Count, nil 19 | } 20 | 21 | func (matcher *HaveLenMatcher) FailureMessage(actual interface{}) (message string) { 22 | return fmt.Sprintf("Expected\n%s\nto have length %d", format.Object(actual, 1), matcher.Count) 23 | } 24 | 25 | func (matcher *HaveLenMatcher) NegatedFailureMessage(actual interface{}) (message string) { 26 | return fmt.Sprintf("Expected\n%s\nnot to have length %d", format.Object(actual, 1), matcher.Count) 27 | } 28 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/succeed_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | "errors" 5 | 6 | . "github.com/onsi/ginkgo" 7 | . "github.com/onsi/gomega" 8 | . "github.com/onsi/gomega/matchers" 9 | ) 10 | 11 | func Erroring() error { 12 | return errors.New("bam") 13 | } 14 | 15 | func NotErroring() error { 16 | return nil 17 | } 18 | 19 | type AnyType struct{} 20 | 21 | func Invalid() *AnyType { 22 | return nil 23 | } 24 | 25 | var _ = Describe("Succeed", func() { 26 | It("should succeed if the function succeeds", func() { 27 | Ω(NotErroring()).Should(Succeed()) 28 | }) 29 | 30 | It("should succeed (in the negated) if the function errored", func() { 31 | Ω(Erroring()).ShouldNot(Succeed()) 32 | }) 33 | 34 | It("should not if passed a non-error", func() { 35 | success, err := (&SucceedMatcher{}).Match(Invalid()) 36 | Ω(success).Should(BeFalse()) 37 | Ω(err).Should(HaveOccurred()) 38 | }) 39 | }) 40 | -------------------------------------------------------------------------------- /dynaml/list_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "github.com/cloudfoundry-incubator/spiff/yaml" 8 | ) 9 | 10 | var _ = Describe("lists", func() { 11 | It("evaluates to an array of nodes", func() { 12 | expr := ListExpr{ 13 | []Expression{ 14 | IntegerExpr{1}, 15 | StringExpr{"two"}, 16 | }, 17 | } 18 | 19 | Expect(expr).To(EvaluateAs([]yaml.Node{node(1), node("two")}, FakeBinding{})) 20 | }) 21 | 22 | Context("when empty", func() { 23 | It("evaluates to an empty array", func() { 24 | Expect(ListExpr{}).To(EvaluateAs([]yaml.Node{}, FakeBinding{})) 25 | }) 26 | }) 27 | 28 | Context("when an entry does not resolve", func() { 29 | It("fails", func() { 30 | expr := ListExpr{ 31 | []Expression{ 32 | ReferenceExpr{[]string{"foo"}}, 33 | }, 34 | } 35 | 36 | Expect(expr).To(FailToEvaluate(FakeBinding{})) 37 | }) 38 | }) 39 | }) 40 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/unfocus_command.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "os/exec" 7 | ) 8 | 9 | func BuildUnfocusCommand() *Command { 10 | return &Command{ 11 | Name: "unfocus", 12 | AltName: "blur", 13 | FlagSet: flag.NewFlagSet("unfocus", flag.ExitOnError), 14 | UsageCommand: "ginkgo unfocus (or ginkgo blur)", 15 | Usage: []string{ 16 | "Recursively unfocuses any focused tests under the current directory", 17 | }, 18 | Command: unfocusSpecs, 19 | } 20 | } 21 | 22 | func unfocusSpecs([]string, []string) { 23 | unfocus("Describe") 24 | unfocus("Context") 25 | unfocus("It") 26 | unfocus("Measure") 27 | } 28 | 29 | func unfocus(component string) { 30 | fmt.Printf("Removing F%s...\n", component) 31 | cmd := exec.Command("gofmt", fmt.Sprintf("-r=F%s -> %s", component, component), "-w", ".") 32 | out, _ := cmd.CombinedOutput() 33 | if string(out) != "" { 34 | println(string(out)) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | ) 7 | 8 | type HaveOccurredMatcher struct { 9 | } 10 | 11 | func (matcher *HaveOccurredMatcher) Match(actual interface{}) (success bool, err error) { 12 | if actual == nil { 13 | return false, nil 14 | } 15 | 16 | if isError(actual) { 17 | return true, nil 18 | } 19 | 20 | return false, fmt.Errorf("Expected an error. Got:\n%s", format.Object(actual, 1)) 21 | } 22 | 23 | func (matcher *HaveOccurredMatcher) FailureMessage(actual interface{}) (message string) { 24 | return fmt.Sprintf("Expected an error to have occured. Got:\n%s", format.Object(actual, 1)) 25 | } 26 | 27 | func (matcher *HaveOccurredMatcher) NegatedFailureMessage(actual interface{}) (message string) { 28 | return fmt.Sprintf("Expected error:\n%s\n%s\n%s", format.Object(actual, 1), format.IndentString(actual.(error).Error(), 1), "not to have occurred") 29 | } 30 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/gexec/prefixed_writer_test.go: -------------------------------------------------------------------------------- 1 | package gexec_test 2 | 3 | import ( 4 | "bytes" 5 | 6 | . "github.com/onsi/gomega/gexec" 7 | 8 | . "github.com/onsi/ginkgo" 9 | . "github.com/onsi/gomega" 10 | ) 11 | 12 | var _ = Describe("PrefixedWriter", func() { 13 | var buffer *bytes.Buffer 14 | var writer *PrefixedWriter 15 | BeforeEach(func() { 16 | buffer = &bytes.Buffer{} 17 | writer = NewPrefixedWriter("[p]", buffer) 18 | }) 19 | 20 | It("should emit the prefix on newlines", func() { 21 | writer.Write([]byte("abc")) 22 | writer.Write([]byte("def\n")) 23 | writer.Write([]byte("hij\n")) 24 | writer.Write([]byte("\n\n")) 25 | writer.Write([]byte("klm\n\nnop")) 26 | writer.Write([]byte("")) 27 | writer.Write([]byte("qrs")) 28 | writer.Write([]byte("\ntuv\nwx")) 29 | writer.Write([]byte("yz\n\n")) 30 | 31 | Ω(buffer.String()).Should(Equal(`[p]abcdef 32 | [p]hij 33 | [p] 34 | [p] 35 | [p]klm 36 | [p] 37 | [p]nopqrs 38 | [p]tuv 39 | [p]wxyz 40 | [p] 41 | `)) 42 | }) 43 | }) 44 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go: -------------------------------------------------------------------------------- 1 | package codelocation 2 | 3 | import ( 4 | "regexp" 5 | "runtime" 6 | "runtime/debug" 7 | "strings" 8 | 9 | "github.com/onsi/ginkgo/types" 10 | ) 11 | 12 | func New(skip int) types.CodeLocation { 13 | _, file, line, _ := runtime.Caller(skip + 1) 14 | stackTrace := PruneStack(string(debug.Stack()), skip) 15 | return types.CodeLocation{FileName: file, LineNumber: line, FullStackTrace: stackTrace} 16 | } 17 | 18 | func PruneStack(fullStackTrace string, skip int) string { 19 | stack := strings.Split(fullStackTrace, "\n") 20 | if len(stack) > 2*(skip+1) { 21 | stack = stack[2*(skip+1):] 22 | } 23 | prunedStack := []string{} 24 | re := regexp.MustCompile(`\/ginkgo\/|\/pkg\/testing\/|\/pkg\/runtime\/`) 25 | for i := 0; i < len(stack)/2; i++ { 26 | if !re.Match([]byte(stack[i*2])) { 27 | prunedStack = append(prunedStack, stack[i*2]) 28 | prunedStack = append(prunedStack, stack[i*2+1]) 29 | } 30 | } 31 | return strings.Join(prunedStack, "\n") 32 | } 33 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | "reflect" 7 | ) 8 | 9 | type AssignableToTypeOfMatcher struct { 10 | Expected interface{} 11 | } 12 | 13 | func (matcher *AssignableToTypeOfMatcher) Match(actual interface{}) (success bool, err error) { 14 | if actual == nil || matcher.Expected == nil { 15 | return false, fmt.Errorf("Refusing to compare to .") 16 | } 17 | 18 | actualType := reflect.TypeOf(actual) 19 | expectedType := reflect.TypeOf(matcher.Expected) 20 | 21 | return actualType.AssignableTo(expectedType), nil 22 | } 23 | 24 | func (matcher *AssignableToTypeOfMatcher) FailureMessage(actual interface{}) string { 25 | return format.Message(actual, fmt.Sprintf("to be assignable to the type: %T", matcher.Expected)) 26 | } 27 | 28 | func (matcher *AssignableToTypeOfMatcher) NegatedFailureMessage(actual interface{}) string { 29 | return format.Message(actual, fmt.Sprintf("not to be assignable to the type: %T", matcher.Expected)) 30 | } 31 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/onsi/gomega/format" 8 | ) 9 | 10 | type BeAnExistingFileMatcher struct { 11 | expected interface{} 12 | } 13 | 14 | func (matcher *BeAnExistingFileMatcher) Match(actual interface{}) (success bool, err error) { 15 | actualFilename, ok := actual.(string) 16 | if !ok { 17 | return false, fmt.Errorf("BeAnExistingFileMatcher matcher expects a file path") 18 | } 19 | 20 | if _, err = os.Stat(actualFilename); err != nil { 21 | switch { 22 | case os.IsNotExist(err): 23 | return false, nil 24 | default: 25 | return false, err 26 | } 27 | } 28 | 29 | return true, nil 30 | } 31 | 32 | func (matcher *BeAnExistingFileMatcher) FailureMessage(actual interface{}) (message string) { 33 | return format.Message(actual, fmt.Sprintf("to exist")) 34 | } 35 | 36 | func (matcher *BeAnExistingFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { 37 | return format.Message(actual, fmt.Sprintf("not to exist")) 38 | } 39 | -------------------------------------------------------------------------------- /dynaml/auto.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "github.com/cloudfoundry-incubator/spiff/yaml" 5 | ) 6 | 7 | type AutoExpr struct { 8 | Path []string 9 | } 10 | 11 | func (e AutoExpr) Evaluate(binding Binding) (yaml.Node, bool) { 12 | if len(e.Path) == 3 && e.Path[0] == "resource_pools" && e.Path[2] == "size" { 13 | jobs, found := binding.FindFromRoot([]string{"jobs"}) 14 | if !found { 15 | return nil, false 16 | } 17 | 18 | jobsList, ok := jobs.Value().([]yaml.Node) 19 | if !ok { 20 | return nil, false 21 | } 22 | 23 | var size int64 24 | 25 | for _, job := range jobsList { 26 | poolName, ok := yaml.FindString(job, "resource_pool") 27 | if !ok { 28 | continue 29 | } 30 | 31 | if poolName != e.Path[1] { 32 | continue 33 | } 34 | 35 | instances, ok := yaml.FindInt(job, "instances") 36 | if !ok { 37 | return nil, false 38 | } 39 | 40 | size += instances 41 | } 42 | 43 | return node(size), true 44 | } 45 | 46 | return nil, false 47 | } 48 | 49 | func (e AutoExpr) String() string { 50 | return "auto" 51 | } 52 | -------------------------------------------------------------------------------- /dynaml/merge_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "github.com/cloudfoundry-incubator/spiff/yaml" 8 | ) 9 | 10 | var _ = Describe("merges", func() { 11 | Context("when the equivalent node is found", func() { 12 | It("evaluates to the merged node", func() { 13 | referencedNode := IntegerExpr{42} 14 | 15 | expr := MergeExpr{[]string{"foo", "bar"}} 16 | 17 | binding := FakeBinding{ 18 | FoundInStubs: map[string]yaml.Node{ 19 | "foo.bar": node(referencedNode), 20 | }, 21 | } 22 | 23 | Expect(expr).To(EvaluateAs(referencedNode, binding)) 24 | }) 25 | }) 26 | 27 | Context("when the equivalent node is NOT found", func() { 28 | It("fails", func() { 29 | referencedNode := IntegerExpr{42} 30 | 31 | expr := MergeExpr{[]string{"foo", "bar", "baz"}} 32 | 33 | binding := FakeBinding{ 34 | FoundInStubs: map[string]yaml.Node{ 35 | "foo.bar": node(referencedNode), 36 | }, 37 | } 38 | 39 | Expect(expr).To(FailToEvaluate(binding)) 40 | }) 41 | }) 42 | }) 43 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | . "github.com/onsi/gomega/matchers" 7 | ) 8 | 9 | var _ = Describe("AssignableToTypeOf", func() { 10 | Context("When asserting assignability between types", func() { 11 | It("should do the right thing", func() { 12 | Ω(0).Should(BeAssignableToTypeOf(0)) 13 | Ω(5).Should(BeAssignableToTypeOf(-1)) 14 | Ω("foo").Should(BeAssignableToTypeOf("bar")) 15 | Ω(struct{ Foo string }{}).Should(BeAssignableToTypeOf(struct{ Foo string }{})) 16 | 17 | Ω(0).ShouldNot(BeAssignableToTypeOf("bar")) 18 | Ω(5).ShouldNot(BeAssignableToTypeOf(struct{ Foo string }{})) 19 | Ω("foo").ShouldNot(BeAssignableToTypeOf(42)) 20 | }) 21 | }) 22 | 23 | Context("When asserting nil values", func() { 24 | It("should error", func() { 25 | success, err := (&AssignableToTypeOfMatcher{Expected: nil}).Match(nil) 26 | Ω(success).Should(BeFalse()) 27 | Ω(err).Should(HaveOccurred()) 28 | }) 29 | }) 30 | }) 31 | -------------------------------------------------------------------------------- /flow/unresolved_check_test.go: -------------------------------------------------------------------------------- 1 | package flow 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "github.com/cloudfoundry-incubator/spiff/dynaml" 8 | "github.com/cloudfoundry-incubator/spiff/yaml" 9 | ) 10 | 11 | var _ = Describe("Reporting unresolved nodes", func() { 12 | It("formats a message listing the nodes", func() { 13 | err := UnresolvedNodes{ 14 | Nodes: []UnresolvedNode{ 15 | { 16 | Node: yaml.NewNode( 17 | dynaml.AutoExpr{}, 18 | "some-file.yml", 19 | ), 20 | Context: []string{"foo", "bar"}, 21 | Path: []string{"foo", "bar"}, 22 | }, 23 | { 24 | Node: yaml.NewNode( 25 | dynaml.MergeExpr{}, 26 | "some-other-file.yml", 27 | ), 28 | Context: []string{"fizz", "[2]", "buzz"}, 29 | Path: []string{"fizz", "fizzbuzz", "buzz"}, 30 | }, 31 | }, 32 | } 33 | 34 | Expect(err.Error()).To(Equal( 35 | `unresolved nodes: 36 | (( auto )) in some-file.yml foo.bar (foo.bar) 37 | (( merge )) in some-other-file.yml fizz.[2].buzz (fizz.fizzbuzz.buzz)`)) 38 | }) 39 | }) 40 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/interrupthandler/interrupt_handler.go: -------------------------------------------------------------------------------- 1 | package interrupthandler 2 | 3 | import ( 4 | "os" 5 | "os/signal" 6 | "sync" 7 | "syscall" 8 | ) 9 | 10 | type InterruptHandler struct { 11 | interruptCount int 12 | lock *sync.Mutex 13 | C chan bool 14 | } 15 | 16 | func NewInterruptHandler() *InterruptHandler { 17 | h := &InterruptHandler{ 18 | lock: &sync.Mutex{}, 19 | C: make(chan bool, 0), 20 | } 21 | 22 | go h.handleInterrupt() 23 | SwallowSigQuit() 24 | 25 | return h 26 | } 27 | 28 | func (h *InterruptHandler) WasInterrupted() bool { 29 | h.lock.Lock() 30 | defer h.lock.Unlock() 31 | 32 | return h.interruptCount > 0 33 | } 34 | 35 | func (h *InterruptHandler) handleInterrupt() { 36 | c := make(chan os.Signal, 1) 37 | signal.Notify(c, os.Interrupt, syscall.SIGTERM) 38 | 39 | <-c 40 | signal.Stop(c) 41 | 42 | h.lock.Lock() 43 | h.interruptCount++ 44 | if h.interruptCount == 1 { 45 | close(h.C) 46 | } else if h.interruptCount > 5 { 47 | os.Exit(1) 48 | } 49 | h.lock.Unlock() 50 | 51 | go h.handleInterrupt() 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/convert_command.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "github.com/onsi/ginkgo/ginkgo/convert" 7 | "os" 8 | ) 9 | 10 | func BuildConvertCommand() *Command { 11 | return &Command{ 12 | Name: "convert", 13 | FlagSet: flag.NewFlagSet("convert", flag.ExitOnError), 14 | UsageCommand: "ginkgo convert /path/to/package", 15 | Usage: []string{ 16 | "Convert the package at the passed in path from an XUnit-style test to a Ginkgo-style test", 17 | }, 18 | Command: convertPackage, 19 | } 20 | } 21 | 22 | func convertPackage(args []string, additionalArgs []string) { 23 | if len(args) != 1 { 24 | println(fmt.Sprintf("usage: ginkgo convert /path/to/your/package")) 25 | os.Exit(1) 26 | } 27 | 28 | defer func() { 29 | err := recover() 30 | if err != nil { 31 | switch err := err.(type) { 32 | case error: 33 | println(err.Error()) 34 | case string: 35 | println(err) 36 | default: 37 | println(fmt.Sprintf("unexpected error: %#v", err)) 38 | } 39 | os.Exit(1) 40 | } 41 | }() 42 | 43 | convert.RewritePackage(args[0]) 44 | } 45 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/testrunner/log_writer.go: -------------------------------------------------------------------------------- 1 | package testrunner 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "io" 7 | "log" 8 | "strings" 9 | "sync" 10 | ) 11 | 12 | type logWriter struct { 13 | buffer *bytes.Buffer 14 | lock *sync.Mutex 15 | log *log.Logger 16 | } 17 | 18 | func newLogWriter(target io.Writer, node int) *logWriter { 19 | return &logWriter{ 20 | buffer: &bytes.Buffer{}, 21 | lock: &sync.Mutex{}, 22 | log: log.New(target, fmt.Sprintf("[%d] ", node), 0), 23 | } 24 | } 25 | 26 | func (w *logWriter) Write(data []byte) (n int, err error) { 27 | w.lock.Lock() 28 | defer w.lock.Unlock() 29 | 30 | w.buffer.Write(data) 31 | contents := w.buffer.String() 32 | 33 | lines := strings.Split(contents, "\n") 34 | for _, line := range lines[0 : len(lines)-1] { 35 | w.log.Println(line) 36 | } 37 | 38 | w.buffer.Reset() 39 | w.buffer.Write([]byte(lines[len(lines)-1])) 40 | return len(data), nil 41 | } 42 | 43 | func (w *logWriter) Close() error { 44 | w.lock.Lock() 45 | defer w.lock.Unlock() 46 | 47 | if w.buffer.Len() > 0 { 48 | w.log.Println(w.buffer.String()) 49 | } 50 | 51 | return nil 52 | } 53 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2014 Onsi Fakhouri 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2014 Onsi Fakhouri 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /dynaml/dynaml.peg: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | type DynamlGrammar Peg {} 4 | 5 | Dynaml <- ws Expression ws !. 6 | 7 | Expression <- Level2 8 | 9 | Level2 <- Or / Level1 10 | 11 | Or <- Level1 req_ws '||' req_ws Expression 12 | 13 | Level1 <- Concatenation / Addition / Subtraction / Level0 14 | 15 | Concatenation <- Level0 [ \t\n\r]+ Level1 16 | Addition <- Level0 req_ws '+' req_ws Level1 17 | Subtraction <- Level0 req_ws '-' req_ws Level1 18 | 19 | Level0 <- Grouped / Call / Boolean / Nil / String / Integer / List / Merge / Auto / Reference 20 | 21 | Grouped <- '(' Expression ')' 22 | 23 | Call <- Name '(' Arguments ')' 24 | Arguments <- Expression (Comma ws Expression)* 25 | Name <- [a-zA-Z0-9_]+ 26 | 27 | Comma <- ',' 28 | 29 | Integer <- '-'? [0-9_]+ 30 | 31 | String <- '"' ('\\"' / !'"' .)* '"' 32 | 33 | Boolean <- 'true' / 'false' 34 | 35 | Nil <- 'nil' 36 | 37 | List <- '[' Contents? ']' 38 | Contents <- Expression (Comma ws Expression)* 39 | 40 | Merge <- 'merge' 41 | 42 | Auto <- 'auto' 43 | 44 | Reference <- '.'? [a-zA-Z0-9_] [a-zA-Z0-9_\-]* ('.' [a-zA-Z0-9_] [a-zA-Z0-9_\-]* / '.' '[' [0-9]+ ']')* 45 | 46 | ws <- [ \t\n\r]* 47 | 48 | req_ws <- [ \t\n\r]+ 49 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_prefix_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | . "github.com/onsi/gomega/matchers" 7 | ) 8 | 9 | var _ = Describe("HavePrefixMatcher", func() { 10 | Context("when actual is a string", func() { 11 | It("should match a string prefix", func() { 12 | Ω("Ab").Should(HavePrefix("A")) 13 | Ω("A").ShouldNot(HavePrefix("Ab")) 14 | }) 15 | }) 16 | 17 | Context("when the matcher is called with multiple arguments", func() { 18 | It("should pass the string and arguments to sprintf", func() { 19 | Ω("C3PO").Should(HavePrefix("C%dP", 3)) 20 | }) 21 | }) 22 | 23 | Context("when actual is a stringer", func() { 24 | It("should call the stringer and match against the returned string", func() { 25 | Ω(&myStringer{a: "Ab"}).Should(HavePrefix("A")) 26 | }) 27 | }) 28 | 29 | Context("when actual is neither a string nor a stringer", func() { 30 | It("should error", func() { 31 | success, err := (&HavePrefixMatcher{Prefix: "2"}).Match(2) 32 | Ω(success).Should(BeFalse()) 33 | Ω(err).Should(HaveOccurred()) 34 | }) 35 | }) 36 | }) 37 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_suffix_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | . "github.com/onsi/gomega/matchers" 7 | ) 8 | 9 | var _ = Describe("HaveSuffixMatcher", func() { 10 | Context("when actual is a string", func() { 11 | It("should match a string suffix", func() { 12 | Ω("Ab").Should(HaveSuffix("b")) 13 | Ω("A").ShouldNot(HaveSuffix("Ab")) 14 | }) 15 | }) 16 | 17 | Context("when the matcher is called with multiple arguments", func() { 18 | It("should pass the string and arguments to sprintf", func() { 19 | Ω("C3PO").Should(HaveSuffix("%dPO", 3)) 20 | }) 21 | }) 22 | 23 | Context("when actual is a stringer", func() { 24 | It("should call the stringer and match against the returned string", func() { 25 | Ω(&myStringer{a: "Ab"}).Should(HaveSuffix("b")) 26 | }) 27 | }) 28 | 29 | Context("when actual is neither a string nor a stringer", func() { 30 | It("should error", func() { 31 | success, err := (&HaveSuffixMatcher{Suffix: "2"}).Match(2) 32 | Ω(success).Should(BeFalse()) 33 | Ω(err).Should(HaveOccurred()) 34 | }) 35 | }) 36 | }) 37 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/libyaml-LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006 Kirill Simonov 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/support/goraph/MIT.LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Amit Kumar Gupta 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/github.com/codegangsta/cli/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 Jeremy Saenz 2 | All Rights Reserved. 3 | 4 | MIT LICENSE 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_prefix_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | ) 7 | 8 | type HavePrefixMatcher struct { 9 | Prefix string 10 | Args []interface{} 11 | } 12 | 13 | func (matcher *HavePrefixMatcher) Match(actual interface{}) (success bool, err error) { 14 | actualString, ok := toString(actual) 15 | if !ok { 16 | return false, fmt.Errorf("HavePrefix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) 17 | } 18 | prefix := matcher.prefix() 19 | return len(actualString) >= len(prefix) && actualString[0:len(prefix)] == prefix, nil 20 | } 21 | 22 | func (matcher *HavePrefixMatcher) prefix() string { 23 | if len(matcher.Args) > 0 { 24 | return fmt.Sprintf(matcher.Prefix, matcher.Args...) 25 | } 26 | return matcher.Prefix 27 | } 28 | 29 | func (matcher *HavePrefixMatcher) FailureMessage(actual interface{}) (message string) { 30 | return format.Message(actual, "to have prefix", matcher.prefix()) 31 | } 32 | 33 | func (matcher *HavePrefixMatcher) NegatedFailureMessage(actual interface{}) (message string) { 34 | return format.Message(actual, "not to have prefix", matcher.prefix()) 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | "reflect" 7 | ) 8 | 9 | type BeEquivalentToMatcher struct { 10 | Expected interface{} 11 | } 12 | 13 | func (matcher *BeEquivalentToMatcher) Match(actual interface{}) (success bool, err error) { 14 | if actual == nil && matcher.Expected == nil { 15 | return false, fmt.Errorf("Both actual and expected must not be nil.") 16 | } 17 | 18 | convertedActual := actual 19 | 20 | if actual != nil && matcher.Expected != nil && reflect.TypeOf(actual).ConvertibleTo(reflect.TypeOf(matcher.Expected)) { 21 | convertedActual = reflect.ValueOf(actual).Convert(reflect.TypeOf(matcher.Expected)).Interface() 22 | } 23 | 24 | return reflect.DeepEqual(convertedActual, matcher.Expected), nil 25 | } 26 | 27 | func (matcher *BeEquivalentToMatcher) FailureMessage(actual interface{}) (message string) { 28 | return format.Message(actual, "to be equivalent to", matcher.Expected) 29 | } 30 | 31 | func (matcher *BeEquivalentToMatcher) NegatedFailureMessage(actual interface{}) (message string) { 32 | return format.Message(actual, "not to be equivalent to", matcher.Expected) 33 | } 34 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support.go: -------------------------------------------------------------------------------- 1 | package testingtsupport 2 | 3 | import ( 4 | "regexp" 5 | "runtime/debug" 6 | "strings" 7 | 8 | "github.com/onsi/gomega/types" 9 | ) 10 | 11 | type gomegaTestingT interface { 12 | Errorf(format string, args ...interface{}) 13 | } 14 | 15 | func BuildTestingTGomegaFailHandler(t gomegaTestingT) types.GomegaFailHandler { 16 | return func(message string, callerSkip ...int) { 17 | skip := 1 18 | if len(callerSkip) > 0 { 19 | skip = callerSkip[0] 20 | } 21 | stackTrace := pruneStack(string(debug.Stack()), skip) 22 | t.Errorf("\n%s\n%s", stackTrace, message) 23 | } 24 | } 25 | 26 | func pruneStack(fullStackTrace string, skip int) string { 27 | stack := strings.Split(fullStackTrace, "\n") 28 | if len(stack) > 2*(skip+1) { 29 | stack = stack[2*(skip+1):] 30 | } 31 | prunedStack := []string{} 32 | re := regexp.MustCompile(`\/ginkgo\/|\/pkg\/testing\/|\/pkg\/runtime\/`) 33 | for i := 0; i < len(stack)/2; i++ { 34 | if !re.Match([]byte(stack[i*2])) { 35 | prunedStack = append(prunedStack, stack[i*2]) 36 | prunedStack = append(prunedStack, stack[i*2+1]) 37 | } 38 | } 39 | return strings.Join(prunedStack, "\n") 40 | } 41 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_suffix_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | ) 7 | 8 | type HaveSuffixMatcher struct { 9 | Suffix string 10 | Args []interface{} 11 | } 12 | 13 | func (matcher *HaveSuffixMatcher) Match(actual interface{}) (success bool, err error) { 14 | actualString, ok := toString(actual) 15 | if !ok { 16 | return false, fmt.Errorf("HaveSuffix matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) 17 | } 18 | suffix := matcher.suffix() 19 | return len(actualString) >= len(suffix) && actualString[len(actualString) - len(suffix):] == suffix, nil 20 | } 21 | 22 | func (matcher *HaveSuffixMatcher) suffix() string { 23 | if len(matcher.Args) > 0 { 24 | return fmt.Sprintf(matcher.Suffix, matcher.Args...) 25 | } 26 | return matcher.Suffix 27 | } 28 | 29 | func (matcher *HaveSuffixMatcher) FailureMessage(actual interface{}) (message string) { 30 | return format.Message(actual, "to have suffix", matcher.suffix()) 31 | } 32 | 33 | func (matcher *HaveSuffixMatcher) NegatedFailureMessage(actual interface{}) (message string) { 34 | return format.Message(actual, "not to have suffix", matcher.suffix()) 35 | } 36 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/leafnodes/it_node.go: -------------------------------------------------------------------------------- 1 | package leafnodes 2 | 3 | import ( 4 | "github.com/onsi/ginkgo/internal/failer" 5 | "github.com/onsi/ginkgo/types" 6 | "time" 7 | ) 8 | 9 | type ItNode struct { 10 | runner *runner 11 | 12 | flag types.FlagType 13 | text string 14 | } 15 | 16 | func NewItNode(text string, body interface{}, flag types.FlagType, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *ItNode { 17 | return &ItNode{ 18 | runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeIt, componentIndex), 19 | flag: flag, 20 | text: text, 21 | } 22 | } 23 | 24 | func (node *ItNode) Run() (outcome types.SpecState, failure types.SpecFailure) { 25 | return node.runner.run() 26 | } 27 | 28 | func (node *ItNode) Type() types.SpecComponentType { 29 | return types.SpecComponentTypeIt 30 | } 31 | 32 | func (node *ItNode) Text() string { 33 | return node.text 34 | } 35 | 36 | func (node *ItNode) Flag() types.FlagType { 37 | return node.flag 38 | } 39 | 40 | func (node *ItNode) CodeLocation() types.CodeLocation { 41 | return node.runner.codeLocation 42 | } 43 | 44 | func (node *ItNode) Samples() int { 45 | return 1 46 | } 47 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_a_directory_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | "io/ioutil" 5 | "os" 6 | 7 | . "github.com/onsi/ginkgo" 8 | . "github.com/onsi/gomega" 9 | . "github.com/onsi/gomega/matchers" 10 | ) 11 | 12 | var _ = Describe("BeADirectoryMatcher", func() { 13 | Context("when passed a string", func() { 14 | It("should do the right thing", func() { 15 | Ω("/dne/test").ShouldNot(BeADirectory()) 16 | 17 | tmpFile, err := ioutil.TempFile("", "gomega-test-tempfile") 18 | Ω(err).ShouldNot(HaveOccurred()) 19 | defer os.Remove(tmpFile.Name()) 20 | Ω(tmpFile.Name()).ShouldNot(BeADirectory()) 21 | 22 | tmpDir, err := ioutil.TempDir("", "gomega-test-tempdir") 23 | Ω(err).ShouldNot(HaveOccurred()) 24 | defer os.Remove(tmpDir) 25 | Ω(tmpDir).Should(BeADirectory()) 26 | }) 27 | }) 28 | 29 | Context("when passed something else", func() { 30 | It("should error", func() { 31 | success, err := (&BeADirectoryMatcher{}).Match(nil) 32 | Ω(success).Should(BeFalse()) 33 | Ω(err).Should(HaveOccurred()) 34 | 35 | success, err = (&BeADirectoryMatcher{}).Match(true) 36 | Ω(success).Should(BeFalse()) 37 | Ω(err).Should(HaveOccurred()) 38 | }) 39 | }) 40 | }) 41 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_a_regular_file_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | "io/ioutil" 5 | "os" 6 | 7 | . "github.com/onsi/ginkgo" 8 | . "github.com/onsi/gomega" 9 | . "github.com/onsi/gomega/matchers" 10 | ) 11 | 12 | var _ = Describe("BeARegularFileMatcher", func() { 13 | Context("when passed a string", func() { 14 | It("should do the right thing", func() { 15 | Ω("/dne/test").ShouldNot(BeARegularFile()) 16 | 17 | tmpFile, err := ioutil.TempFile("", "gomega-test-tempfile") 18 | Ω(err).ShouldNot(HaveOccurred()) 19 | defer os.Remove(tmpFile.Name()) 20 | Ω(tmpFile.Name()).Should(BeARegularFile()) 21 | 22 | tmpDir, err := ioutil.TempDir("", "gomega-test-tempdir") 23 | Ω(err).ShouldNot(HaveOccurred()) 24 | defer os.Remove(tmpDir) 25 | Ω(tmpDir).ShouldNot(BeARegularFile()) 26 | }) 27 | }) 28 | 29 | Context("when passed something else", func() { 30 | It("should error", func() { 31 | success, err := (&BeARegularFileMatcher{}).Match(nil) 32 | Ω(success).Should(BeFalse()) 33 | Ω(err).Should(HaveOccurred()) 34 | 35 | success, err = (&BeARegularFileMatcher{}).Match(true) 36 | Ω(success).Should(BeFalse()) 37 | Ω(err).Should(HaveOccurred()) 38 | }) 39 | }) 40 | }) 41 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/contain_substring_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | . "github.com/onsi/gomega/matchers" 7 | ) 8 | 9 | var _ = Describe("ContainSubstringMatcher", func() { 10 | Context("when actual is a string", func() { 11 | It("should match against the string", func() { 12 | Ω("Marvelous").Should(ContainSubstring("rve")) 13 | Ω("Marvelous").ShouldNot(ContainSubstring("boo")) 14 | }) 15 | }) 16 | 17 | Context("when the matcher is called with multiple arguments", func() { 18 | It("should pass the string and arguments to sprintf", func() { 19 | Ω("Marvelous3").Should(ContainSubstring("velous%d", 3)) 20 | }) 21 | }) 22 | 23 | Context("when actual is a stringer", func() { 24 | It("should call the stringer and match agains the returned string", func() { 25 | Ω(&myStringer{a: "Abc3"}).Should(ContainSubstring("bc3")) 26 | }) 27 | }) 28 | 29 | Context("when actual is neither a string nor a stringer", func() { 30 | It("should error", func() { 31 | success, err := (&ContainSubstringMatcher{Substr: "2"}).Match(2) 32 | Ω(success).Should(BeFalse()) 33 | Ω(err).Should(HaveOccurred()) 34 | }) 35 | }) 36 | }) 37 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/panic_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | . "github.com/onsi/gomega/matchers" 7 | ) 8 | 9 | var _ = Describe("Panic", func() { 10 | Context("when passed something that's not a function that takes zero arguments and returns nothing", func() { 11 | It("should error", func() { 12 | success, err := (&PanicMatcher{}).Match("foo") 13 | Ω(success).Should(BeFalse()) 14 | Ω(err).Should(HaveOccurred()) 15 | 16 | success, err = (&PanicMatcher{}).Match(nil) 17 | Ω(success).Should(BeFalse()) 18 | Ω(err).Should(HaveOccurred()) 19 | 20 | success, err = (&PanicMatcher{}).Match(func(foo string) {}) 21 | Ω(success).Should(BeFalse()) 22 | Ω(err).Should(HaveOccurred()) 23 | 24 | success, err = (&PanicMatcher{}).Match(func() string { return "bar" }) 25 | Ω(success).Should(BeFalse()) 26 | Ω(err).Should(HaveOccurred()) 27 | }) 28 | }) 29 | 30 | Context("when passed a function of the correct type", func() { 31 | It("should call the function and pass if the function panics", func() { 32 | Ω(func() { panic("ack!") }).Should(Panic()) 33 | Ω(func() {}).ShouldNot(Panic()) 34 | }) 35 | }) 36 | }) 37 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_an_existing_file_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | "io/ioutil" 5 | "os" 6 | 7 | . "github.com/onsi/ginkgo" 8 | . "github.com/onsi/gomega" 9 | . "github.com/onsi/gomega/matchers" 10 | ) 11 | 12 | var _ = Describe("BeAnExistingFileMatcher", func() { 13 | Context("when passed a string", func() { 14 | It("should do the right thing", func() { 15 | Ω("/dne/test").ShouldNot(BeAnExistingFile()) 16 | 17 | tmpFile, err := ioutil.TempFile("", "gomega-test-tempfile") 18 | Ω(err).ShouldNot(HaveOccurred()) 19 | defer os.Remove(tmpFile.Name()) 20 | Ω(tmpFile.Name()).Should(BeAnExistingFile()) 21 | 22 | tmpDir, err := ioutil.TempDir("", "gomega-test-tempdir") 23 | Ω(err).ShouldNot(HaveOccurred()) 24 | defer os.Remove(tmpDir) 25 | Ω(tmpDir).Should(BeAnExistingFile()) 26 | }) 27 | }) 28 | 29 | Context("when passed something else", func() { 30 | It("should error", func() { 31 | success, err := (&BeAnExistingFileMatcher{}).Match(nil) 32 | Ω(success).Should(BeFalse()) 33 | Ω(err).Should(HaveOccurred()) 34 | 35 | success, err = (&BeAnExistingFileMatcher{}).Match(true) 36 | Ω(success).Should(BeFalse()) 37 | Ω(err).Should(HaveOccurred()) 38 | }) 39 | }) 40 | }) 41 | -------------------------------------------------------------------------------- /vendor/github.com/codegangsta/cli/command_test.go: -------------------------------------------------------------------------------- 1 | package cli_test 2 | 3 | import ( 4 | "flag" 5 | "testing" 6 | 7 | "github.com/codegangsta/cli" 8 | ) 9 | 10 | func TestCommandDoNotIgnoreFlags(t *testing.T) { 11 | app := cli.NewApp() 12 | set := flag.NewFlagSet("test", 0) 13 | test := []string{"blah", "blah", "-break"} 14 | set.Parse(test) 15 | 16 | c := cli.NewContext(app, set, set) 17 | 18 | command := cli.Command{ 19 | Name: "test-cmd", 20 | Aliases: []string{"tc"}, 21 | Usage: "this is for testing", 22 | Description: "testing", 23 | Action: func(_ *cli.Context) {}, 24 | } 25 | err := command.Run(c) 26 | 27 | expect(t, err.Error(), "flag provided but not defined: -break") 28 | } 29 | 30 | func TestCommandIgnoreFlags(t *testing.T) { 31 | app := cli.NewApp() 32 | set := flag.NewFlagSet("test", 0) 33 | test := []string{"blah", "blah"} 34 | set.Parse(test) 35 | 36 | c := cli.NewContext(app, set, set) 37 | 38 | command := cli.Command{ 39 | Name: "test-cmd", 40 | Aliases: []string{"tc"}, 41 | Usage: "this is for testing", 42 | Description: "testing", 43 | Action: func(_ *cli.Context) {}, 44 | SkipFlagParsing: true, 45 | } 46 | err := command.Run(c) 47 | 48 | expect(t, err, nil) 49 | } 50 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | "strings" 7 | ) 8 | 9 | type ContainSubstringMatcher struct { 10 | Substr string 11 | Args []interface{} 12 | } 13 | 14 | func (matcher *ContainSubstringMatcher) Match(actual interface{}) (success bool, err error) { 15 | actualString, ok := toString(actual) 16 | if !ok { 17 | return false, fmt.Errorf("ContainSubstring matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) 18 | } 19 | 20 | return strings.Contains(actualString, matcher.stringToMatch()), nil 21 | } 22 | 23 | func (matcher *ContainSubstringMatcher) stringToMatch() string { 24 | stringToMatch := matcher.Substr 25 | if len(matcher.Args) > 0 { 26 | stringToMatch = fmt.Sprintf(matcher.Substr, matcher.Args...) 27 | } 28 | return stringToMatch 29 | } 30 | 31 | func (matcher *ContainSubstringMatcher) FailureMessage(actual interface{}) (message string) { 32 | return format.Message(actual, "to contain substring", matcher.stringToMatch()) 33 | } 34 | 35 | func (matcher *ContainSubstringMatcher) NegatedFailureMessage(actual interface{}) (message string) { 36 | return format.Message(actual, "not to contain substring", matcher.stringToMatch()) 37 | } 38 | -------------------------------------------------------------------------------- /flow/cascade_as_helper_test.go: -------------------------------------------------------------------------------- 1 | package flow 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | 7 | "github.com/cloudfoundry-incubator/spiff/yaml" 8 | ) 9 | 10 | func CascadeAs(expected yaml.Node, stubs ...yaml.Node) *CascadeAsMatcher { 11 | return &CascadeAsMatcher{Expected: expected, Stubs: stubs} 12 | } 13 | 14 | type CascadeAsMatcher struct { 15 | Expected yaml.Node 16 | Stubs []yaml.Node 17 | actual yaml.Node 18 | } 19 | 20 | func (matcher *CascadeAsMatcher) Match(source interface{}) (success bool, err error) { 21 | if source == nil && matcher.Expected == nil { 22 | return false, fmt.Errorf("Refusing to compare to .") 23 | } 24 | 25 | matcher.actual, err = Cascade(source.(yaml.Node), matcher.Stubs...) 26 | if err != nil { 27 | return false, err 28 | } 29 | 30 | if reflect.DeepEqual(matcher.actual, matcher.Expected) { 31 | return true, nil 32 | } else { 33 | return false, nil 34 | } 35 | 36 | return 37 | } 38 | 39 | func (matcher *CascadeAsMatcher) FailureMessage(actual interface{}) (message string) { 40 | return formatMessage(matcher.actual, "to flow as", matcher.Expected) 41 | } 42 | 43 | func (matcher *CascadeAsMatcher) NegatedFailureMessage(actual interface{}) (message string) { 44 | return formatMessage(matcher.actual, "not to flow as", matcher.Expected) 45 | } 46 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/panic_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | "reflect" 7 | ) 8 | 9 | type PanicMatcher struct{} 10 | 11 | func (matcher *PanicMatcher) Match(actual interface{}) (success bool, err error) { 12 | if actual == nil { 13 | return false, fmt.Errorf("PanicMatcher expects a non-nil actual.") 14 | } 15 | 16 | actualType := reflect.TypeOf(actual) 17 | if actualType.Kind() != reflect.Func { 18 | return false, fmt.Errorf("PanicMatcher expects a function. Got:\n%s", format.Object(actual, 1)) 19 | } 20 | if !(actualType.NumIn() == 0 && actualType.NumOut() == 0) { 21 | return false, fmt.Errorf("PanicMatcher expects a function with no arguments and no return value. Got:\n%s", format.Object(actual, 1)) 22 | } 23 | 24 | success = false 25 | defer func() { 26 | if e := recover(); e != nil { 27 | success = true 28 | } 29 | }() 30 | 31 | reflect.ValueOf(actual).Call([]reflect.Value{}) 32 | 33 | return 34 | } 35 | 36 | func (matcher *PanicMatcher) FailureMessage(actual interface{}) (message string) { 37 | return format.Message(actual, "to panic") 38 | } 39 | 40 | func (matcher *PanicMatcher) NegatedFailureMessage(actual interface{}) (message string) { 41 | return format.Message(actual, "not to panic") 42 | } 43 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/support/goraph/bipartitegraph/bipartitegraph.go: -------------------------------------------------------------------------------- 1 | package bipartitegraph 2 | 3 | import "errors" 4 | import "fmt" 5 | 6 | import . "github.com/onsi/gomega/matchers/support/goraph/node" 7 | import . "github.com/onsi/gomega/matchers/support/goraph/edge" 8 | 9 | type BipartiteGraph struct { 10 | Left NodeOrderedSet 11 | Right NodeOrderedSet 12 | Edges EdgeSet 13 | } 14 | 15 | func NewBipartiteGraph(leftValues, rightValues []interface{}, neighbours func(interface{}, interface{}) (bool, error)) (*BipartiteGraph, error) { 16 | left := NodeOrderedSet{} 17 | for i, _ := range leftValues { 18 | left = append(left, Node{i}) 19 | } 20 | 21 | right := NodeOrderedSet{} 22 | for j, _ := range rightValues { 23 | right = append(right, Node{j + len(left)}) 24 | } 25 | 26 | edges := EdgeSet{} 27 | for i, leftValue := range leftValues { 28 | for j, rightValue := range rightValues { 29 | neighbours, err := neighbours(leftValue, rightValue) 30 | if err != nil { 31 | return nil, errors.New(fmt.Sprintf("error determining adjacency for %v and %v: %s", leftValue, rightValue, err.Error())) 32 | } 33 | 34 | if neighbours { 35 | edges = append(edges, Edge{left[i], right[j]}) 36 | } 37 | } 38 | } 39 | 40 | return &BipartiteGraph{left, right, edges}, nil 41 | } 42 | -------------------------------------------------------------------------------- /dynaml/concatenation.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | 7 | "github.com/cloudfoundry-incubator/spiff/yaml" 8 | ) 9 | 10 | type ConcatenationExpr struct { 11 | A Expression 12 | B Expression 13 | } 14 | 15 | func (e ConcatenationExpr) Evaluate(binding Binding) (yaml.Node, bool) { 16 | a, ok := e.A.Evaluate(binding) 17 | if !ok { 18 | return nil, false 19 | } 20 | 21 | b, ok := e.B.Evaluate(binding) 22 | if !ok { 23 | return nil, false 24 | } 25 | 26 | val, ok := concatenateStringAndInt(a, b) 27 | if ok { 28 | return node(val), true 29 | } 30 | 31 | alist, aok := a.Value().([]yaml.Node) 32 | blist, bok := b.Value().([]yaml.Node) 33 | if aok && bok { 34 | return node(append(alist, blist...)), true 35 | } 36 | 37 | return nil, false 38 | } 39 | 40 | func (e ConcatenationExpr) String() string { 41 | return fmt.Sprintf("%s %s", e.A, e.B) 42 | } 43 | 44 | func concatenateStringAndInt(a yaml.Node, b yaml.Node) (string, bool) { 45 | aString, aOk := a.Value().(string) 46 | if aOk { 47 | bString, bOk := b.Value().(string) 48 | if bOk { 49 | return aString + bString, true 50 | } else { 51 | bInt, bOk := b.Value().(int64) 52 | if bOk { 53 | return aString + strconv.FormatInt(bInt, 10), true 54 | } 55 | } 56 | } 57 | 58 | return "", false 59 | } 60 | -------------------------------------------------------------------------------- /dynaml/reference_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "github.com/cloudfoundry-incubator/spiff/yaml" 8 | ) 9 | 10 | var _ = Describe("references", func() { 11 | Context("when the reference is found", func() { 12 | It("evaluates to the referenced node", func() { 13 | expr := ReferenceExpr{[]string{"foo", "bar"}} 14 | 15 | binding := FakeBinding{ 16 | FoundReferences: map[string]yaml.Node{ 17 | "foo": node(nil), 18 | "foo.bar": node(42), 19 | }, 20 | } 21 | 22 | Expect(expr).To(EvaluateAs(42, binding)) 23 | }) 24 | 25 | Context("and it refers to another expression", func() { 26 | It("returns itself so the referred node can evaluate first", func() { 27 | expr := ReferenceExpr{[]string{"foo", "bar"}} 28 | 29 | binding := FakeBinding{ 30 | FoundReferences: map[string]yaml.Node{ 31 | "foo": node(MergeExpr{}), 32 | }, 33 | } 34 | 35 | Expect(expr).To(EvaluateAs(expr, binding)) 36 | }) 37 | }) 38 | }) 39 | 40 | Context("when the reference is NOT found", func() { 41 | It("fails", func() { 42 | expr := ReferenceExpr{[]string{"foo", "bar", "baz"}} 43 | 44 | binding := FakeBinding{} 45 | 46 | Expect(expr).To(FailToEvaluate(binding)) 47 | }) 48 | }) 49 | }) 50 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go: -------------------------------------------------------------------------------- 1 | package edge 2 | 3 | import . "github.com/onsi/gomega/matchers/support/goraph/node" 4 | 5 | type Edge struct { 6 | Node1 Node 7 | Node2 Node 8 | } 9 | 10 | type EdgeSet []Edge 11 | 12 | func (ec EdgeSet) Free(node Node) bool { 13 | for _, e := range ec { 14 | if e.Node1 == node || e.Node2 == node { 15 | return false 16 | } 17 | } 18 | 19 | return true 20 | } 21 | 22 | func (ec EdgeSet) Contains(edge Edge) bool { 23 | for _, e := range ec { 24 | if e == edge { 25 | return true 26 | } 27 | } 28 | 29 | return false 30 | } 31 | 32 | func (ec EdgeSet) FindByNodes(node1, node2 Node) (Edge, bool) { 33 | for _, e := range ec { 34 | if (e.Node1 == node1 && e.Node2 == node2) || (e.Node1 == node2 && e.Node2 == node1) { 35 | return e, true 36 | } 37 | } 38 | 39 | return Edge{}, false 40 | } 41 | 42 | func (ec EdgeSet) SymmetricDifference(ec2 EdgeSet) EdgeSet { 43 | edgesToInclude := make(map[Edge]bool) 44 | 45 | for _, e := range ec { 46 | edgesToInclude[e] = true 47 | } 48 | 49 | for _, e := range ec2 { 50 | edgesToInclude[e] = !edgesToInclude[e] 51 | } 52 | 53 | result := EdgeSet{} 54 | for e, include := range edgesToInclude { 55 | if include { 56 | result = append(result, e) 57 | } 58 | } 59 | 60 | return result 61 | } 62 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/match_regexp_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | "regexp" 7 | ) 8 | 9 | type MatchRegexpMatcher struct { 10 | Regexp string 11 | Args []interface{} 12 | } 13 | 14 | func (matcher *MatchRegexpMatcher) Match(actual interface{}) (success bool, err error) { 15 | actualString, ok := toString(actual) 16 | if !ok { 17 | return false, fmt.Errorf("RegExp matcher requires a string or stringer.\nGot:%s", format.Object(actual, 1)) 18 | } 19 | 20 | match, err := regexp.Match(matcher.regexp(), []byte(actualString)) 21 | if err != nil { 22 | return false, fmt.Errorf("RegExp match failed to compile with error:\n\t%s", err.Error()) 23 | } 24 | 25 | return match, nil 26 | } 27 | 28 | func (matcher *MatchRegexpMatcher) FailureMessage(actual interface{}) (message string) { 29 | return format.Message(actual, "to match regular expression", matcher.regexp()) 30 | } 31 | 32 | func (matcher *MatchRegexpMatcher) NegatedFailureMessage(actual interface{}) (message string) { 33 | return format.Message(actual, "not to match regular expression", matcher.regexp()) 34 | } 35 | 36 | func (matcher *MatchRegexpMatcher) regexp() string { 37 | re := matcher.Regexp 38 | if len(matcher.Args) > 0 { 39 | re = fmt.Sprintf(matcher.Regexp, matcher.Args...) 40 | } 41 | return re 42 | } 43 | -------------------------------------------------------------------------------- /flow/cascade_test.go: -------------------------------------------------------------------------------- 1 | package flow 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | ) 7 | 8 | var _ = Describe("Cascading YAML templates", func() { 9 | It("flows through multiple templates", func() { 10 | source := parseYAML(` 11 | --- 12 | foo: (( merge )) 13 | baz: 42 14 | `) 15 | 16 | secondary := parseYAML(` 17 | --- 18 | foo: 19 | bar: (( merge )) 20 | xyz: (( bar )) 21 | `) 22 | 23 | stub := parseYAML(` 24 | --- 25 | foo: 26 | bar: merged! 27 | `) 28 | 29 | resolved := parseYAML(` 30 | --- 31 | foo: 32 | bar: merged! 33 | xyz: merged! 34 | baz: 42 35 | `) 36 | 37 | Expect(source).To(CascadeAs(resolved, secondary, stub)) 38 | }) 39 | 40 | Context("with multiple mutually-exclusive templates", func() { 41 | It("flows through both", func() { 42 | source := parseYAML(` 43 | --- 44 | foo: (( merge )) 45 | baz: (( merge )) 46 | `) 47 | 48 | secondary := parseYAML(` 49 | --- 50 | foo: 51 | bar: (( merge )) 52 | `) 53 | 54 | tertiary := parseYAML(` 55 | --- 56 | baz: 57 | a: 1 58 | b: (( merge )) 59 | `) 60 | 61 | stub := parseYAML(` 62 | --- 63 | foo: 64 | bar: merged! 65 | baz: 66 | b: 2 67 | `) 68 | 69 | resolved := parseYAML(` 70 | --- 71 | foo: 72 | bar: merged! 73 | baz: 74 | a: 1 75 | b: 2 76 | `) 77 | 78 | Expect(source).To(CascadeAs(resolved, secondary, tertiary, stub)) 79 | }) 80 | }) 81 | }) 82 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/gexec/prefixed_writer.go: -------------------------------------------------------------------------------- 1 | package gexec 2 | 3 | import ( 4 | "io" 5 | "sync" 6 | ) 7 | 8 | /* 9 | PrefixedWriter wraps an io.Writer, emiting the passed in prefix at the beginning of each new line. 10 | This can be useful when running multiple gexec.Sessions concurrently - you can prefix the log output of each 11 | session by passing in a PrefixedWriter: 12 | 13 | gexec.Start(cmd, NewPrefixedWriter("[my-cmd] ", GinkgoWriter), NewPrefixedWriter("[my-cmd] ", GinkgoWriter)) 14 | */ 15 | type PrefixedWriter struct { 16 | prefix []byte 17 | writer io.Writer 18 | lock *sync.Mutex 19 | atStartOfLine bool 20 | } 21 | 22 | func NewPrefixedWriter(prefix string, writer io.Writer) *PrefixedWriter { 23 | return &PrefixedWriter{ 24 | prefix: []byte(prefix), 25 | writer: writer, 26 | lock: &sync.Mutex{}, 27 | atStartOfLine: true, 28 | } 29 | } 30 | 31 | func (w *PrefixedWriter) Write(b []byte) (int, error) { 32 | w.lock.Lock() 33 | defer w.lock.Unlock() 34 | 35 | toWrite := []byte{} 36 | 37 | for _, c := range b { 38 | if w.atStartOfLine { 39 | toWrite = append(toWrite, w.prefix...) 40 | } 41 | 42 | toWrite = append(toWrite, c) 43 | 44 | w.atStartOfLine = c == '\n' 45 | } 46 | 47 | _, err := w.writer.Write(toWrite) 48 | if err != nil { 49 | return 0, err 50 | } 51 | 52 | return len(b), nil 53 | } 54 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/cloudfoundry-incubator/candiedyaml.svg)](https://travis-ci.org/cloudfoundry-incubator/candiedyaml) 2 | 3 | candiedyaml 4 | =========== 5 | 6 | YAML for Go 7 | 8 | A YAML 1.1 parser with support for YAML 1.2 features 9 | 10 | Usage 11 | ----- 12 | 13 | ```go 14 | package myApp 15 | 16 | import ( 17 | "github.com/cloudfoundry-incubator/candiedyaml" 18 | "fmt" 19 | "os" 20 | ) 21 | 22 | func main() { 23 | file, err := os.Open("path/to/some/file.yml") 24 | if err != nil { 25 | println("File does not exist:", err.Error()) 26 | os.Exit(1) 27 | } 28 | 29 | document := new(interface{}) 30 | decoder := candiedyaml.NewDecoder(file) 31 | err = decoder.Decode(document) 32 | 33 | if err != nil { 34 | println("Failed to decode document:", err.Error()) 35 | } 36 | 37 | println("parsed yml into interface:", fmt.Sprintf("%#v", document)) 38 | 39 | fileToWrite, err := os.Create("path/to/some/new/file.yml") 40 | if err != nil { 41 | println("Failed to open file for writing:", err.Error()) 42 | os.Exit(1) 43 | } 44 | 45 | encoder := candiedyaml.NewEncoder(fileToWrite) 46 | err = encoder.Encode(document) 47 | 48 | if err != nil { 49 | println("Failed to encode document:", err.Error()) 50 | os.Exit(1) 51 | } 52 | 53 | return 54 | } 55 | ``` 56 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/integration/coverage_test.go: -------------------------------------------------------------------------------- 1 | package integration_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | "github.com/onsi/gomega/gexec" 7 | "os" 8 | "os/exec" 9 | ) 10 | 11 | var _ = Describe("Coverage Specs", func() { 12 | AfterEach(func() { 13 | os.RemoveAll("./_fixtures/coverage_fixture/coverage_fixture.coverprofile") 14 | }) 15 | 16 | It("runs coverage analysis in series and in parallel", func() { 17 | session := startGinkgo("./_fixtures/coverage_fixture", "-cover") 18 | Eventually(session).Should(gexec.Exit(0)) 19 | output := session.Out.Contents() 20 | Ω(output).Should(ContainSubstring("coverage: 80.0% of statements")) 21 | 22 | serialCoverProfileOutput, err := exec.Command("go", "tool", "cover", "-func=./_fixtures/coverage_fixture/coverage_fixture.coverprofile").CombinedOutput() 23 | Ω(err).ShouldNot(HaveOccurred()) 24 | 25 | os.RemoveAll("./_fixtures/coverage_fixture/coverage_fixture.coverprofile") 26 | 27 | Eventually(startGinkgo("./_fixtures/coverage_fixture", "-cover", "-nodes=4")).Should(gexec.Exit(0)) 28 | 29 | parallelCoverProfileOutput, err := exec.Command("go", "tool", "cover", "-func=./_fixtures/coverage_fixture/coverage_fixture.coverprofile").CombinedOutput() 30 | Ω(err).ShouldNot(HaveOccurred()) 31 | 32 | Ω(parallelCoverProfileOutput).Should(Equal(serialCoverProfileOutput)) 33 | }) 34 | }) 35 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | "reflect" 7 | ) 8 | 9 | type BeClosedMatcher struct { 10 | } 11 | 12 | func (matcher *BeClosedMatcher) Match(actual interface{}) (success bool, err error) { 13 | if !isChan(actual) { 14 | return false, fmt.Errorf("BeClosed matcher expects a channel. Got:\n%s", format.Object(actual, 1)) 15 | } 16 | 17 | channelType := reflect.TypeOf(actual) 18 | channelValue := reflect.ValueOf(actual) 19 | 20 | if channelType.ChanDir() == reflect.SendDir { 21 | return false, fmt.Errorf("BeClosed matcher cannot determine if a send-only channel is closed or open. Got:\n%s", format.Object(actual, 1)) 22 | } 23 | 24 | winnerIndex, _, open := reflect.Select([]reflect.SelectCase{ 25 | reflect.SelectCase{Dir: reflect.SelectRecv, Chan: channelValue}, 26 | reflect.SelectCase{Dir: reflect.SelectDefault}, 27 | }) 28 | 29 | var closed bool 30 | if winnerIndex == 0 { 31 | closed = !open 32 | } else if winnerIndex == 1 { 33 | closed = false 34 | } 35 | 36 | return closed, nil 37 | } 38 | 39 | func (matcher *BeClosedMatcher) FailureMessage(actual interface{}) (message string) { 40 | return format.Message(actual, "to be closed") 41 | } 42 | 43 | func (matcher *BeClosedMatcher) NegatedFailureMessage(actual interface{}) (message string) { 44 | return format.Message(actual, "to be open") 45 | } 46 | -------------------------------------------------------------------------------- /dynaml/auto_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "github.com/cloudfoundry-incubator/spiff/yaml" 8 | ) 9 | 10 | var _ = Describe("autos", func() { 11 | Context("when the path is resource_pools.*.size", func() { 12 | expr := AutoExpr{[]string{"resource_pools", "some_pool", "size"}} 13 | 14 | It("sums up the instances of the jobs in the pool", func() { 15 | binding := FakeBinding{ 16 | FoundFromRoot: map[string]yaml.Node{ 17 | "jobs": parseYAML(` 18 | - name: some_job 19 | resource_pool: some_pool 20 | instances: 3 21 | - name: some_other_job 22 | resource_pool: some_pool 23 | instances: 5 24 | - name: some_other_job 25 | resource_pool: some_other_pool 26 | instances: 5 27 | `), 28 | }, 29 | } 30 | 31 | Expect(expr).To(EvaluateAs(8, binding)) 32 | }) 33 | 34 | Context("when one of the jobs has non-numeric instances", func() { 35 | It("returns nil", func() { 36 | binding := FakeBinding{ 37 | FoundFromRoot: map[string]yaml.Node{ 38 | "jobs": parseYAML(` 39 | - name: some_job 40 | resource_pool: some_pool 41 | instances: 3 42 | - name: some_other_job 43 | resource_pool: some_pool 44 | instances: not-evaluated-yet 45 | - name: some_other_job 46 | resource_pool: some_other_pool 47 | instances: 5 48 | `), 49 | }, 50 | } 51 | 52 | Expect(expr).To(FailToEvaluate(binding)) 53 | }) 54 | }) 55 | }) 56 | }) 57 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_empty_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | . "github.com/onsi/gomega/matchers" 7 | ) 8 | 9 | var _ = Describe("BeEmpty", func() { 10 | Context("when passed a supported type", func() { 11 | It("should do the right thing", func() { 12 | Ω("").Should(BeEmpty()) 13 | Ω(" ").ShouldNot(BeEmpty()) 14 | 15 | Ω([0]int{}).Should(BeEmpty()) 16 | Ω([1]int{1}).ShouldNot(BeEmpty()) 17 | 18 | Ω([]int{}).Should(BeEmpty()) 19 | Ω([]int{1}).ShouldNot(BeEmpty()) 20 | 21 | Ω(map[string]int{}).Should(BeEmpty()) 22 | Ω(map[string]int{"a": 1}).ShouldNot(BeEmpty()) 23 | 24 | c := make(chan bool, 1) 25 | Ω(c).Should(BeEmpty()) 26 | c <- true 27 | Ω(c).ShouldNot(BeEmpty()) 28 | }) 29 | }) 30 | 31 | Context("when passed a correctly typed nil", func() { 32 | It("should be true", func() { 33 | var nilSlice []int 34 | Ω(nilSlice).Should(BeEmpty()) 35 | 36 | var nilMap map[int]string 37 | Ω(nilMap).Should(BeEmpty()) 38 | }) 39 | }) 40 | 41 | Context("when passed an unsupported type", func() { 42 | It("should error", func() { 43 | success, err := (&BeEmptyMatcher{}).Match(0) 44 | Ω(success).Should(BeFalse()) 45 | Ω(err).Should(HaveOccurred()) 46 | 47 | success, err = (&BeEmptyMatcher{}).Match(nil) 48 | Ω(success).Should(BeFalse()) 49 | Ω(err).Should(HaveOccurred()) 50 | }) 51 | }) 52 | }) 53 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/match_regexp_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | . "github.com/onsi/gomega/matchers" 7 | ) 8 | 9 | var _ = Describe("MatchRegexp", func() { 10 | Context("when actual is a string", func() { 11 | It("should match against the string", func() { 12 | Ω(" a2!bla").Should(MatchRegexp(`\d!`)) 13 | Ω(" a2!bla").ShouldNot(MatchRegexp(`[A-Z]`)) 14 | }) 15 | }) 16 | 17 | Context("when actual is a stringer", func() { 18 | It("should call the stringer and match agains the returned string", func() { 19 | Ω(&myStringer{a: "Abc3"}).Should(MatchRegexp(`[A-Z][a-z]+\d`)) 20 | }) 21 | }) 22 | 23 | Context("when the matcher is called with multiple arguments", func() { 24 | It("should pass the string and arguments to sprintf", func() { 25 | Ω(" a23!bla").Should(MatchRegexp(`\d%d!`, 3)) 26 | }) 27 | }) 28 | 29 | Context("when actual is neither a string nor a stringer", func() { 30 | It("should error", func() { 31 | success, err := (&MatchRegexpMatcher{Regexp: `\d`}).Match(2) 32 | Ω(success).Should(BeFalse()) 33 | Ω(err).Should(HaveOccurred()) 34 | }) 35 | }) 36 | 37 | Context("when the passed in regexp fails to compile", func() { 38 | It("should error", func() { 39 | success, err := (&MatchRegexpMatcher{Regexp: "("}).Match("Foo") 40 | Ω(success).Should(BeFalse()) 41 | Ω(err).Should(HaveOccurred()) 42 | }) 43 | }) 44 | }) 45 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/writer/writer.go: -------------------------------------------------------------------------------- 1 | package writer 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | "sync" 7 | ) 8 | 9 | type WriterInterface interface { 10 | io.Writer 11 | 12 | Truncate() 13 | DumpOut() 14 | DumpOutWithHeader(header string) 15 | } 16 | 17 | type Writer struct { 18 | buffer *bytes.Buffer 19 | outWriter io.Writer 20 | lock *sync.Mutex 21 | stream bool 22 | } 23 | 24 | func New(outWriter io.Writer) *Writer { 25 | return &Writer{ 26 | buffer: &bytes.Buffer{}, 27 | lock: &sync.Mutex{}, 28 | outWriter: outWriter, 29 | stream: true, 30 | } 31 | } 32 | 33 | func (w *Writer) SetStream(stream bool) { 34 | w.lock.Lock() 35 | defer w.lock.Unlock() 36 | w.stream = stream 37 | } 38 | 39 | func (w *Writer) Write(b []byte) (n int, err error) { 40 | w.lock.Lock() 41 | defer w.lock.Unlock() 42 | 43 | if w.stream { 44 | return w.outWriter.Write(b) 45 | } else { 46 | return w.buffer.Write(b) 47 | } 48 | } 49 | 50 | func (w *Writer) Truncate() { 51 | w.lock.Lock() 52 | defer w.lock.Unlock() 53 | w.buffer.Reset() 54 | } 55 | 56 | func (w *Writer) DumpOut() { 57 | w.lock.Lock() 58 | defer w.lock.Unlock() 59 | if !w.stream { 60 | w.buffer.WriteTo(w.outWriter) 61 | } 62 | } 63 | 64 | func (w *Writer) DumpOutWithHeader(header string) { 65 | w.lock.Lock() 66 | defer w.lock.Unlock() 67 | if !w.stream && w.buffer.Len() > 0 { 68 | w.outWriter.Write([]byte(header)) 69 | w.buffer.WriteTo(w.outWriter) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_a_directory.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/onsi/gomega/format" 8 | ) 9 | 10 | type notADirectoryError struct { 11 | os.FileInfo 12 | } 13 | 14 | func (t notADirectoryError) Error() string { 15 | fileInfo := os.FileInfo(t) 16 | switch { 17 | case fileInfo.Mode().IsRegular(): 18 | return "file is a regular file" 19 | default: 20 | return fmt.Sprintf("file mode is: %s", fileInfo.Mode().String()) 21 | } 22 | } 23 | 24 | type BeADirectoryMatcher struct { 25 | expected interface{} 26 | err error 27 | } 28 | 29 | func (matcher *BeADirectoryMatcher) Match(actual interface{}) (success bool, err error) { 30 | actualFilename, ok := actual.(string) 31 | if !ok { 32 | return false, fmt.Errorf("BeADirectoryMatcher matcher expects a file path") 33 | } 34 | 35 | fileInfo, err := os.Stat(actualFilename) 36 | if err != nil { 37 | matcher.err = err 38 | return false, nil 39 | } 40 | 41 | if !fileInfo.Mode().IsDir() { 42 | matcher.err = notADirectoryError{fileInfo} 43 | return false, nil 44 | } 45 | return true, nil 46 | } 47 | 48 | func (matcher *BeADirectoryMatcher) FailureMessage(actual interface{}) (message string) { 49 | return format.Message(actual, fmt.Sprintf("to be a directory: %s", matcher.err)) 50 | } 51 | 52 | func (matcher *BeADirectoryMatcher) NegatedFailureMessage(actual interface{}) (message string) { 53 | return format.Message(actual, fmt.Sprintf("not be a directory")) 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/onsi/gomega/format" 8 | ) 9 | 10 | type notARegularFileError struct { 11 | os.FileInfo 12 | } 13 | 14 | func (t notARegularFileError) Error() string { 15 | fileInfo := os.FileInfo(t) 16 | switch { 17 | case fileInfo.IsDir(): 18 | return "file is a directory" 19 | default: 20 | return fmt.Sprintf("file mode is: %s", fileInfo.Mode().String()) 21 | } 22 | } 23 | 24 | type BeARegularFileMatcher struct { 25 | expected interface{} 26 | err error 27 | } 28 | 29 | func (matcher *BeARegularFileMatcher) Match(actual interface{}) (success bool, err error) { 30 | actualFilename, ok := actual.(string) 31 | if !ok { 32 | return false, fmt.Errorf("BeARegularFileMatcher matcher expects a file path") 33 | } 34 | 35 | fileInfo, err := os.Stat(actualFilename) 36 | if err != nil { 37 | matcher.err = err 38 | return false, nil 39 | } 40 | 41 | if !fileInfo.Mode().IsRegular() { 42 | matcher.err = notARegularFileError{fileInfo} 43 | return false, nil 44 | } 45 | return true, nil 46 | } 47 | 48 | func (matcher *BeARegularFileMatcher) FailureMessage(actual interface{}) (message string) { 49 | return format.Message(actual, fmt.Sprintf("to be a regular file: %s", matcher.err)) 50 | } 51 | 52 | func (matcher *BeARegularFileMatcher) NegatedFailureMessage(actual interface{}) (message string) { 53 | return format.Message(actual, fmt.Sprintf("not be a regular file")) 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/leafnodes/setup_nodes.go: -------------------------------------------------------------------------------- 1 | package leafnodes 2 | 3 | import ( 4 | "github.com/onsi/ginkgo/internal/failer" 5 | "github.com/onsi/ginkgo/types" 6 | "time" 7 | ) 8 | 9 | type SetupNode struct { 10 | runner *runner 11 | } 12 | 13 | func (node *SetupNode) Run() (outcome types.SpecState, failure types.SpecFailure) { 14 | return node.runner.run() 15 | } 16 | 17 | func (node *SetupNode) Type() types.SpecComponentType { 18 | return node.runner.nodeType 19 | } 20 | 21 | func (node *SetupNode) CodeLocation() types.CodeLocation { 22 | return node.runner.codeLocation 23 | } 24 | 25 | func NewBeforeEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *SetupNode { 26 | return &SetupNode{ 27 | runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeBeforeEach, componentIndex), 28 | } 29 | } 30 | 31 | func NewAfterEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *SetupNode { 32 | return &SetupNode{ 33 | runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeAfterEach, componentIndex), 34 | } 35 | } 36 | 37 | func NewJustBeforeEachNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer, componentIndex int) *SetupNode { 38 | return &SetupNode{ 39 | runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeJustBeforeEach, componentIndex), 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /spiff_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "io/ioutil" 5 | "os" 6 | "os/exec" 7 | 8 | . "github.com/onsi/ginkgo" 9 | . "github.com/onsi/gomega" 10 | . "github.com/onsi/gomega/gbytes" 11 | . "github.com/onsi/gomega/gexec" 12 | ) 13 | 14 | var _ = Describe("Running spiff", func() { 15 | Describe("merge", func() { 16 | var merge *Session 17 | 18 | Context("when given a bad file path", func() { 19 | BeforeEach(func() { 20 | var err error 21 | merge, err = Start(exec.Command(spiff, "merge", "foo.yml"), GinkgoWriter, GinkgoWriter) 22 | Expect(err).NotTo(HaveOccurred()) 23 | }) 24 | 25 | It("says file not found", func() { 26 | Expect(merge.Wait()).To(Exit(1)) 27 | Expect(merge.Err).To(Say("foo.yml: no such file or directory")) 28 | }) 29 | }) 30 | 31 | Context("when given a single file", func() { 32 | var basicTemplate *os.File 33 | 34 | BeforeEach(func() { 35 | var err error 36 | 37 | basicTemplate, err = ioutil.TempFile(os.TempDir(), "basic.yml") 38 | Expect(err).NotTo(HaveOccurred()) 39 | basicTemplate.Write([]byte(` 40 | --- 41 | foo: bar 42 | `)) 43 | merge, err = Start(exec.Command(spiff, "merge", basicTemplate.Name()), GinkgoWriter, GinkgoWriter) 44 | Expect(err).NotTo(HaveOccurred()) 45 | }) 46 | 47 | AfterEach(func() { 48 | os.Remove(basicTemplate.Name()) 49 | }) 50 | 51 | It("resolves the template and prints it out", func() { 52 | Expect(merge.Wait()).To(Exit(0)) 53 | Expect(merge.Out).To(Say(`foo: bar`)) 54 | }) 55 | }) 56 | }) 57 | }) 58 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_len_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | . "github.com/onsi/gomega/matchers" 7 | ) 8 | 9 | var _ = Describe("HaveLen", func() { 10 | Context("when passed a supported type", func() { 11 | It("should do the right thing", func() { 12 | Ω("").Should(HaveLen(0)) 13 | Ω("AA").Should(HaveLen(2)) 14 | 15 | Ω([0]int{}).Should(HaveLen(0)) 16 | Ω([2]int{1, 2}).Should(HaveLen(2)) 17 | 18 | Ω([]int{}).Should(HaveLen(0)) 19 | Ω([]int{1, 2, 3}).Should(HaveLen(3)) 20 | 21 | Ω(map[string]int{}).Should(HaveLen(0)) 22 | Ω(map[string]int{"a": 1, "b": 2, "c": 3, "d": 4}).Should(HaveLen(4)) 23 | 24 | c := make(chan bool, 3) 25 | Ω(c).Should(HaveLen(0)) 26 | c <- true 27 | c <- true 28 | Ω(c).Should(HaveLen(2)) 29 | }) 30 | }) 31 | 32 | Context("when passed a correctly typed nil", func() { 33 | It("should operate succesfully on the passed in value", func() { 34 | var nilSlice []int 35 | Ω(nilSlice).Should(HaveLen(0)) 36 | 37 | var nilMap map[int]string 38 | Ω(nilMap).Should(HaveLen(0)) 39 | }) 40 | }) 41 | 42 | Context("when passed an unsupported type", func() { 43 | It("should error", func() { 44 | success, err := (&HaveLenMatcher{Count: 0}).Match(0) 45 | Ω(success).Should(BeFalse()) 46 | Ω(err).Should(HaveOccurred()) 47 | 48 | success, err = (&HaveLenMatcher{Count: 0}).Match(nil) 49 | Ω(success).Should(BeFalse()) 50 | Ω(err).Should(HaveOccurred()) 51 | }) 52 | }) 53 | }) 54 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/leafnodes/setup_nodes_test.go: -------------------------------------------------------------------------------- 1 | package leafnodes_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | "github.com/onsi/ginkgo/types" 6 | . "github.com/onsi/gomega" 7 | 8 | . "github.com/onsi/ginkgo/internal/leafnodes" 9 | 10 | "github.com/onsi/ginkgo/internal/codelocation" 11 | ) 12 | 13 | var _ = Describe("Setup Nodes", func() { 14 | Describe("BeforeEachNodes", func() { 15 | It("should report the correct type and code location", func() { 16 | codeLocation := codelocation.New(0) 17 | beforeEach := NewBeforeEachNode(func() {}, codeLocation, 0, nil, 3) 18 | Ω(beforeEach.Type()).Should(Equal(types.SpecComponentTypeBeforeEach)) 19 | Ω(beforeEach.CodeLocation()).Should(Equal(codeLocation)) 20 | }) 21 | }) 22 | 23 | Describe("AfterEachNodes", func() { 24 | It("should report the correct type and code location", func() { 25 | codeLocation := codelocation.New(0) 26 | afterEach := NewAfterEachNode(func() {}, codeLocation, 0, nil, 3) 27 | Ω(afterEach.Type()).Should(Equal(types.SpecComponentTypeAfterEach)) 28 | Ω(afterEach.CodeLocation()).Should(Equal(codeLocation)) 29 | }) 30 | }) 31 | 32 | Describe("JustBeforeEachNodes", func() { 33 | It("should report the correct type and code location", func() { 34 | codeLocation := codelocation.New(0) 35 | justBeforeEach := NewJustBeforeEachNode(func() {}, codeLocation, 0, nil, 3) 36 | Ω(justBeforeEach.Type()).Should(Equal(types.SpecComponentTypeJustBeforeEach)) 37 | Ω(justBeforeEach.CodeLocation()).Should(Equal(codeLocation)) 38 | }) 39 | }) 40 | }) 41 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/convert/test_finder.go: -------------------------------------------------------------------------------- 1 | package convert 2 | 3 | import ( 4 | "go/ast" 5 | "regexp" 6 | ) 7 | 8 | /* 9 | * Given a root node, walks its top level statements and returns 10 | * points to function nodes to rewrite as It statements. 11 | * These functions, according to Go testing convention, must be named 12 | * TestWithCamelCasedName and receive a single *testing.T argument. 13 | */ 14 | func findTestFuncs(rootNode *ast.File) (testsToRewrite []*ast.FuncDecl) { 15 | testNameRegexp := regexp.MustCompile("^Test[0-9A-Z].+") 16 | 17 | ast.Inspect(rootNode, func(node ast.Node) bool { 18 | if node == nil { 19 | return false 20 | } 21 | 22 | switch node := node.(type) { 23 | case *ast.FuncDecl: 24 | matches := testNameRegexp.MatchString(node.Name.Name) 25 | 26 | if matches && receivesTestingT(node) { 27 | testsToRewrite = append(testsToRewrite, node) 28 | } 29 | } 30 | 31 | return true 32 | }) 33 | 34 | return 35 | } 36 | 37 | /* 38 | * convenience function that looks at args to a function and determines if its 39 | * params include an argument of type *testing.T 40 | */ 41 | func receivesTestingT(node *ast.FuncDecl) bool { 42 | if len(node.Type.Params.List) != 1 { 43 | return false 44 | } 45 | 46 | base, ok := node.Type.Params.List[0].Type.(*ast.StarExpr) 47 | if !ok { 48 | return false 49 | } 50 | 51 | intermediate := base.X.(*ast.SelectorExpr) 52 | isTestingPackage := intermediate.X.(*ast.Ident).Name == "testing" 53 | isTestingT := intermediate.Sel.Name == "T" 54 | 55 | return isTestingPackage && isTestingT 56 | } 57 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/match_error_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | "reflect" 7 | ) 8 | 9 | type MatchErrorMatcher struct { 10 | Expected interface{} 11 | } 12 | 13 | func (matcher *MatchErrorMatcher) Match(actual interface{}) (success bool, err error) { 14 | if isNil(actual) { 15 | return false, fmt.Errorf("Expected an error, got nil") 16 | } 17 | 18 | if !isError(actual) { 19 | return false, fmt.Errorf("Expected an error. Got:\n%s", format.Object(actual, 1)) 20 | } 21 | 22 | actualErr := actual.(error) 23 | 24 | if isString(matcher.Expected) { 25 | return reflect.DeepEqual(actualErr.Error(), matcher.Expected), nil 26 | } 27 | 28 | if isError(matcher.Expected) { 29 | return reflect.DeepEqual(actualErr, matcher.Expected), nil 30 | } 31 | 32 | var subMatcher omegaMatcher 33 | var hasSubMatcher bool 34 | if matcher.Expected != nil { 35 | subMatcher, hasSubMatcher = (matcher.Expected).(omegaMatcher) 36 | if hasSubMatcher { 37 | return subMatcher.Match(actualErr.Error()) 38 | } 39 | } 40 | 41 | return false, fmt.Errorf("MatchError must be passed an error, string, or Matcher that can match on strings. Got:\n%s", format.Object(matcher.Expected, 1)) 42 | } 43 | 44 | func (matcher *MatchErrorMatcher) FailureMessage(actual interface{}) (message string) { 45 | return format.Message(actual, "to match error", matcher.Expected) 46 | } 47 | 48 | func (matcher *MatchErrorMatcher) NegatedFailureMessage(actual interface{}) (message string) { 49 | return format.Message(actual, "not to match error", matcher.Expected) 50 | } 51 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/have_key_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | "reflect" 7 | ) 8 | 9 | type HaveKeyMatcher struct { 10 | Key interface{} 11 | } 12 | 13 | func (matcher *HaveKeyMatcher) Match(actual interface{}) (success bool, err error) { 14 | if !isMap(actual) { 15 | return false, fmt.Errorf("HaveKey matcher expects a map. Got:%s", format.Object(actual, 1)) 16 | } 17 | 18 | keyMatcher, keyIsMatcher := matcher.Key.(omegaMatcher) 19 | if !keyIsMatcher { 20 | keyMatcher = &EqualMatcher{Expected: matcher.Key} 21 | } 22 | 23 | keys := reflect.ValueOf(actual).MapKeys() 24 | for i := 0; i < len(keys); i++ { 25 | success, err := keyMatcher.Match(keys[i].Interface()) 26 | if err != nil { 27 | return false, fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, err.Error()) 28 | } 29 | if success { 30 | return true, nil 31 | } 32 | } 33 | 34 | return false, nil 35 | } 36 | 37 | func (matcher *HaveKeyMatcher) FailureMessage(actual interface{}) (message string) { 38 | switch matcher.Key.(type) { 39 | case omegaMatcher: 40 | return format.Message(actual, "to have key matching", matcher.Key) 41 | default: 42 | return format.Message(actual, "to have key", matcher.Key) 43 | } 44 | } 45 | 46 | func (matcher *HaveKeyMatcher) NegatedFailureMessage(actual interface{}) (message string) { 47 | switch matcher.Key.(type) { 48 | case omegaMatcher: 49 | return format.Message(actual, "not to have key matching", matcher.Key) 50 | default: 51 | return format.Message(actual, "not to have key", matcher.Key) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /flow/environment.go: -------------------------------------------------------------------------------- 1 | package flow 2 | 3 | import ( 4 | "github.com/cloudfoundry-incubator/spiff/yaml" 5 | ) 6 | 7 | type Scope []map[string]yaml.Node 8 | 9 | type Environment struct { 10 | Scope Scope 11 | Path []string 12 | 13 | Stubs []yaml.Node 14 | } 15 | 16 | func (e Environment) FindFromRoot(path []string) (yaml.Node, bool) { 17 | if len(e.Scope) == 0 { 18 | return nil, false 19 | } 20 | 21 | return yaml.Find(yaml.NewNode(e.Scope[0], "scope"), path...) 22 | } 23 | 24 | func (e Environment) FindReference(path []string) (yaml.Node, bool) { 25 | root, found := resolveSymbol(path[0], e.Scope) 26 | if !found { 27 | return nil, false 28 | } 29 | 30 | return yaml.Find(root, path[1:]...) 31 | } 32 | 33 | func (e Environment) FindInStubs(path []string) (yaml.Node, bool) { 34 | for _, stub := range e.Stubs { 35 | val, found := yaml.Find(stub, path...) 36 | if found { 37 | return val, true 38 | } 39 | } 40 | 41 | return nil, false 42 | } 43 | 44 | func (e Environment) WithScope(step map[string]yaml.Node) Environment { 45 | newScope := make([]map[string]yaml.Node, len(e.Scope)) 46 | copy(newScope, e.Scope) 47 | e.Scope = append(newScope, step) 48 | return e 49 | } 50 | 51 | func (e Environment) WithPath(step string) Environment { 52 | newPath := make([]string, len(e.Path)) 53 | copy(newPath, e.Path) 54 | e.Path = append(newPath, step) 55 | return e 56 | } 57 | 58 | func resolveSymbol(name string, context Scope) (yaml.Node, bool) { 59 | for i := len(context); i > 0; i-- { 60 | ctx := context[i-1] 61 | val := ctx[name] 62 | if val != nil { 63 | return val, true 64 | } 65 | } 66 | 67 | return nil, false 68 | } 69 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | . "github.com/onsi/gomega/matchers" 7 | ) 8 | 9 | var _ = Describe("BeEquivalentTo", func() { 10 | Context("when asserting that nil is equivalent to nil", func() { 11 | It("should error", func() { 12 | success, err := (&BeEquivalentToMatcher{Expected: nil}).Match(nil) 13 | 14 | Ω(success).Should(BeFalse()) 15 | Ω(err).Should(HaveOccurred()) 16 | }) 17 | }) 18 | 19 | Context("When asserting on nil", func() { 20 | It("should do the right thing", func() { 21 | Ω("foo").ShouldNot(BeEquivalentTo(nil)) 22 | Ω(nil).ShouldNot(BeEquivalentTo(3)) 23 | Ω([]int{1, 2}).ShouldNot(BeEquivalentTo(nil)) 24 | }) 25 | }) 26 | 27 | Context("When asserting on type aliases", func() { 28 | It("should the right thing", func() { 29 | Ω(StringAlias("foo")).Should(BeEquivalentTo("foo")) 30 | Ω("foo").Should(BeEquivalentTo(StringAlias("foo"))) 31 | Ω(StringAlias("foo")).ShouldNot(BeEquivalentTo("bar")) 32 | Ω("foo").ShouldNot(BeEquivalentTo(StringAlias("bar"))) 33 | }) 34 | }) 35 | 36 | Context("When asserting on numbers", func() { 37 | It("should convert actual to expected and do the right thing", func() { 38 | Ω(5).Should(BeEquivalentTo(5)) 39 | Ω(5.0).Should(BeEquivalentTo(5.0)) 40 | Ω(5).Should(BeEquivalentTo(5.0)) 41 | 42 | Ω(5).ShouldNot(BeEquivalentTo("5")) 43 | Ω(5).ShouldNot(BeEquivalentTo(3)) 44 | 45 | //Here be dragons! 46 | Ω(5.1).Should(BeEquivalentTo(5)) 47 | Ω(5).ShouldNot(BeEquivalentTo(5.1)) 48 | }) 49 | }) 50 | }) 51 | -------------------------------------------------------------------------------- /dynaml/evaluate_as_helper_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/cloudfoundry-incubator/spiff/yaml" 7 | ) 8 | 9 | func EvaluateAs(expected interface{}, binding Binding) *EvaluateAsMatcher { 10 | return &EvaluateAsMatcher{Expected: node(expected), Binding: binding} 11 | } 12 | 13 | type EvaluateAsMatcher struct { 14 | Expected yaml.Node 15 | Binding Binding 16 | actual yaml.Node 17 | } 18 | 19 | func (matcher *EvaluateAsMatcher) Match(source interface{}) (success bool, err error) { 20 | if source == nil && matcher.Expected == nil { 21 | return false, fmt.Errorf("Refusing to compare to .") 22 | } 23 | 24 | expr, ok := source.(Expression) 25 | if !ok { 26 | return false, fmt.Errorf("Not an expression: %v\n", source) 27 | } 28 | 29 | matcher.actual, ok = expr.Evaluate(matcher.Binding) 30 | if matcher.actual == nil || !ok { 31 | return false, fmt.Errorf("Node failed to evaluate.") 32 | } 33 | 34 | if matcher.actual.EquivalentToNode(matcher.Expected) { 35 | return true, nil 36 | } else { 37 | return false, nil 38 | } 39 | 40 | return 41 | } 42 | 43 | func formatMessage(actual interface{}, message string, expected interface{}) string { 44 | return fmt.Sprintf("Expected %s %#v, got %#v", message, expected, actual) 45 | } 46 | 47 | func (matcher *EvaluateAsMatcher) FailureMessage(actual interface{}) (message string) { 48 | return formatMessage(matcher.actual, "to evaluate to", matcher.Expected) 49 | } 50 | 51 | func (matcher *EvaluateAsMatcher) NegatedFailureMessage(actual interface{}) (message string) { 52 | return formatMessage(matcher.actual, "not to evaluate to", matcher.Expected) 53 | } 54 | -------------------------------------------------------------------------------- /examples/tutorial.md: -------------------------------------------------------------------------------- 1 | ### `spiff merge a.yml b.yml c.yml` 2 | 3 | #### `a.yml` 4 | 5 | ```yaml 6 | hello: world 7 | happy: (( merge )) 8 | ``` 9 | 10 | #### `b.yml` 11 | 12 | ```yaml 13 | foo: bar 14 | ``` 15 | 16 | #### `c.yml` 17 | 18 | ```yaml 19 | happy: birthday 20 | ``` 21 | 22 | #### output 23 | 24 | ```yaml 25 | happy: birthday 26 | hello: world 27 | ``` 28 | 29 | Note: happy will reach all the way down to c to grab “birthday” 30 | 31 | --------------------------------------- 32 | 33 | ### `spiff merge a.yml b.yml` 34 | 35 | #### `a.yml` 36 | 37 | ```yaml 38 | hello: world 39 | happy: ~ 40 | ``` 41 | 42 | #### `b.yml` 43 | 44 | ```yaml 45 | foo: bar 46 | happy: new_year 47 | ``` 48 | 49 | #### output 50 | 51 | ```yaml 52 | happy: new_year 53 | hello: world 54 | ``` 55 | 56 | Note: When the "happy" key appears in two places, the right most value wins out. 57 | There is an implicit merge. 58 | 59 | --------------------------------------- 60 | 61 | ### `spiff merge a.yml b.yml` 62 | 63 | #### `a.yml` 64 | 65 | ```yaml 66 | happy: 67 | - name: holidays 68 | date: yesterday 69 | - name: new_year 70 | date: tomorrow 71 | ``` 72 | 73 | #### `b.yml` 74 | 75 | ```yaml 76 | happy: 77 | - name: birthday 78 | date: today 79 | - name: new_year 80 | date: "12/31" 81 | ``` 82 | 83 | #### output 84 | 85 | ```yaml 86 | happy: 87 | - date: yesterday 88 | name: holidays 89 | - date: 12/31 90 | name: new_year 91 | ``` 92 | 93 | Arrays are a special exception. "name" is a special key, which 94 | identifies a member of an array for possible merging. If there is overlap of 95 | name during a merge, the rightmost file wins, for that element. 96 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | 7 | "github.com/onsi/gomega/format" 8 | ) 9 | 10 | type ContainElementMatcher struct { 11 | Element interface{} 12 | } 13 | 14 | func (matcher *ContainElementMatcher) Match(actual interface{}) (success bool, err error) { 15 | if !isArrayOrSlice(actual) && !isMap(actual) { 16 | return false, fmt.Errorf("ContainElement matcher expects an array/slice/map. Got:\n%s", format.Object(actual, 1)) 17 | } 18 | 19 | elemMatcher, elementIsMatcher := matcher.Element.(omegaMatcher) 20 | if !elementIsMatcher { 21 | elemMatcher = &EqualMatcher{Expected: matcher.Element} 22 | } 23 | 24 | value := reflect.ValueOf(actual) 25 | var keys []reflect.Value 26 | if isMap(actual) { 27 | keys = value.MapKeys() 28 | } 29 | var lastError error 30 | for i := 0; i < value.Len(); i++ { 31 | var success bool 32 | var err error 33 | if isMap(actual) { 34 | success, err = elemMatcher.Match(value.MapIndex(keys[i]).Interface()) 35 | } else { 36 | success, err = elemMatcher.Match(value.Index(i).Interface()) 37 | } 38 | if err != nil { 39 | lastError = err 40 | continue 41 | } 42 | if success { 43 | return true, nil 44 | } 45 | } 46 | 47 | return false, lastError 48 | } 49 | 50 | func (matcher *ContainElementMatcher) FailureMessage(actual interface{}) (message string) { 51 | return format.Message(actual, "to contain element matching", matcher.Element) 52 | } 53 | 54 | func (matcher *ContainElementMatcher) NegatedFailureMessage(actual interface{}) (message string) { 55 | return format.Message(actual, "not to contain element matching", matcher.Element) 56 | } 57 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/integration/interrupt_test.go: -------------------------------------------------------------------------------- 1 | package integration_test 2 | 3 | import ( 4 | "os/exec" 5 | 6 | . "github.com/onsi/ginkgo" 7 | . "github.com/onsi/gomega" 8 | "github.com/onsi/gomega/gbytes" 9 | "github.com/onsi/gomega/gexec" 10 | ) 11 | 12 | var _ = Describe("Interrupt", func() { 13 | var pathToTest string 14 | BeforeEach(func() { 15 | pathToTest = tmpPath("hanging") 16 | copyIn("hanging_suite", pathToTest) 17 | }) 18 | 19 | Context("when interrupting a suite", func() { 20 | var session *gexec.Session 21 | BeforeEach(func() { 22 | //we need to signal the actual process, so we must compile the test first 23 | var err error 24 | cmd := exec.Command("go", "test", "-c") 25 | cmd.Dir = pathToTest 26 | session, err = gexec.Start(cmd, GinkgoWriter, GinkgoWriter) 27 | Ω(err).ShouldNot(HaveOccurred()) 28 | Eventually(session).Should(gexec.Exit(0)) 29 | 30 | //then run the compiled test directly 31 | cmd = exec.Command("./hanging.test", "--test.v=true", "--ginkgo.noColor") 32 | cmd.Dir = pathToTest 33 | session, err = gexec.Start(cmd, GinkgoWriter, GinkgoWriter) 34 | Ω(err).ShouldNot(HaveOccurred()) 35 | 36 | Eventually(session).Should(gbytes.Say("Sleeping...")) 37 | session.Interrupt() 38 | Eventually(session, 1000).Should(gexec.Exit(1)) 39 | }) 40 | 41 | It("should emit the contents of the GinkgoWriter", func() { 42 | Ω(session).Should(gbytes.Say("Just beginning")) 43 | Ω(session).Should(gbytes.Say("Almost there...")) 44 | Ω(session).Should(gbytes.Say("Hanging Out")) 45 | }) 46 | 47 | It("should run the AfterSuite", func() { 48 | Ω(session).Should(gbytes.Say("Heading Out After Suite")) 49 | }) 50 | }) 51 | }) 52 | -------------------------------------------------------------------------------- /yaml/parser.go: -------------------------------------------------------------------------------- 1 | package yaml 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "reflect" 7 | 8 | "github.com/cloudfoundry-incubator/candiedyaml" 9 | ) 10 | 11 | type NonStringKeyError struct { 12 | Key interface{} 13 | } 14 | 15 | func (e NonStringKeyError) Error() string { 16 | return fmt.Sprintf("map key must be a string: %#v", e.Key) 17 | } 18 | 19 | func Parse(sourceName string, source []byte) (Node, error) { 20 | var parsed interface{} 21 | 22 | err := candiedyaml.Unmarshal(source, &parsed) 23 | if err != nil { 24 | return nil, err 25 | } 26 | 27 | return sanitize(sourceName, parsed) 28 | } 29 | 30 | func sanitize(sourceName string, root interface{}) (Node, error) { 31 | switch rootVal := root.(type) { 32 | case map[interface{}]interface{}: 33 | sanitized := map[string]Node{} 34 | 35 | for key, val := range rootVal { 36 | str, ok := key.(string) 37 | if !ok { 38 | return nil, NonStringKeyError{key} 39 | } 40 | 41 | sub, err := sanitize(sourceName, val) 42 | if err != nil { 43 | return nil, err 44 | } 45 | 46 | sanitized[str] = sub 47 | } 48 | 49 | return AnnotatedNode{sanitized, sourceName}, nil 50 | 51 | case []interface{}: 52 | sanitized := []Node{} 53 | 54 | for _, val := range rootVal { 55 | sub, err := sanitize(sourceName, val) 56 | if err != nil { 57 | return nil, err 58 | } 59 | 60 | sanitized = append(sanitized, sub) 61 | } 62 | 63 | return AnnotatedNode{sanitized, sourceName}, nil 64 | 65 | case string, []byte, int64, float64, bool, nil: 66 | return AnnotatedNode{rootVal, sourceName}, nil 67 | } 68 | 69 | return nil, errors.New(fmt.Sprintf("unknown type (%s) during sanitization: %#v\n", reflect.TypeOf(root).String(), root)) 70 | } 71 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/leafnodes/measure_node.go: -------------------------------------------------------------------------------- 1 | package leafnodes 2 | 3 | import ( 4 | "github.com/onsi/ginkgo/internal/failer" 5 | "github.com/onsi/ginkgo/types" 6 | "reflect" 7 | ) 8 | 9 | type MeasureNode struct { 10 | runner *runner 11 | 12 | text string 13 | flag types.FlagType 14 | samples int 15 | benchmarker *benchmarker 16 | } 17 | 18 | func NewMeasureNode(text string, body interface{}, flag types.FlagType, codeLocation types.CodeLocation, samples int, failer *failer.Failer, componentIndex int) *MeasureNode { 19 | benchmarker := newBenchmarker() 20 | 21 | wrappedBody := func() { 22 | reflect.ValueOf(body).Call([]reflect.Value{reflect.ValueOf(benchmarker)}) 23 | } 24 | 25 | return &MeasureNode{ 26 | runner: newRunner(wrappedBody, codeLocation, 0, failer, types.SpecComponentTypeMeasure, componentIndex), 27 | 28 | text: text, 29 | flag: flag, 30 | samples: samples, 31 | benchmarker: benchmarker, 32 | } 33 | } 34 | 35 | func (node *MeasureNode) Run() (outcome types.SpecState, failure types.SpecFailure) { 36 | return node.runner.run() 37 | } 38 | 39 | func (node *MeasureNode) MeasurementsReport() map[string]*types.SpecMeasurement { 40 | return node.benchmarker.measurementsReport() 41 | } 42 | 43 | func (node *MeasureNode) Type() types.SpecComponentType { 44 | return types.SpecComponentTypeMeasure 45 | } 46 | 47 | func (node *MeasureNode) Text() string { 48 | return node.text 49 | } 50 | 51 | func (node *MeasureNode) Flag() types.FlagType { 52 | return node.flag 53 | } 54 | 55 | func (node *MeasureNode) CodeLocation() types.CodeLocation { 56 | return node.runner.codeLocation 57 | } 58 | 59 | func (node *MeasureNode) Samples() int { 60 | return node.samples 61 | } 62 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/leafnodes/suite_nodes.go: -------------------------------------------------------------------------------- 1 | package leafnodes 2 | 3 | import ( 4 | "github.com/onsi/ginkgo/internal/failer" 5 | "github.com/onsi/ginkgo/types" 6 | "time" 7 | ) 8 | 9 | type SuiteNode interface { 10 | Run(parallelNode int, parallelTotal int, syncHost string) bool 11 | Passed() bool 12 | Summary() *types.SetupSummary 13 | } 14 | 15 | type simpleSuiteNode struct { 16 | runner *runner 17 | outcome types.SpecState 18 | failure types.SpecFailure 19 | runTime time.Duration 20 | } 21 | 22 | func (node *simpleSuiteNode) Run(parallelNode int, parallelTotal int, syncHost string) bool { 23 | t := time.Now() 24 | node.outcome, node.failure = node.runner.run() 25 | node.runTime = time.Since(t) 26 | 27 | return node.outcome == types.SpecStatePassed 28 | } 29 | 30 | func (node *simpleSuiteNode) Passed() bool { 31 | return node.outcome == types.SpecStatePassed 32 | } 33 | 34 | func (node *simpleSuiteNode) Summary() *types.SetupSummary { 35 | return &types.SetupSummary{ 36 | ComponentType: node.runner.nodeType, 37 | CodeLocation: node.runner.codeLocation, 38 | State: node.outcome, 39 | RunTime: node.runTime, 40 | Failure: node.failure, 41 | } 42 | } 43 | 44 | func NewBeforeSuiteNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer) SuiteNode { 45 | return &simpleSuiteNode{ 46 | runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeBeforeSuite, 0), 47 | } 48 | } 49 | 50 | func NewAfterSuiteNode(body interface{}, codeLocation types.CodeLocation, timeout time.Duration, failer *failer.Failer) SuiteNode { 51 | return &simpleSuiteNode{ 52 | runner: newRunner(body, codeLocation, timeout, failer, types.SpecComponentTypeAfterSuite, 0), 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/github.com/cloudfoundry-incubator/candiedyaml/run_parser.go: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed under the Apache License, Version 2.0 (the "License"); 3 | you may not use this file except in compliance with the License. 4 | You may obtain a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | */ 14 | 15 | package candiedyaml 16 | 17 | import ( 18 | "fmt" 19 | "os" 20 | ) 21 | 22 | func Run_parser(cmd string, args []string) { 23 | for i := 0; i < len(args); i++ { 24 | fmt.Printf("[%d] Scanning '%s'", i, args[i]) 25 | file, err := os.Open(args[i]) 26 | if err != nil { 27 | panic(fmt.Sprintf("Invalid file '%s': %s", args[i], err.Error())) 28 | } 29 | 30 | parser := yaml_parser_t{} 31 | yaml_parser_initialize(&parser) 32 | yaml_parser_set_input_reader(&parser, file) 33 | 34 | failed := false 35 | token := yaml_token_t{} 36 | count := 0 37 | for { 38 | if !yaml_parser_scan(&parser, &token) { 39 | failed = true 40 | break 41 | } 42 | 43 | if token.token_type == yaml_STREAM_END_TOKEN { 44 | break 45 | } 46 | count++ 47 | } 48 | 49 | file.Close() 50 | 51 | msg := "SUCCESS" 52 | if failed { 53 | msg = "FAILED" 54 | if parser.error != yaml_NO_ERROR { 55 | m := parser.problem_mark 56 | fmt.Printf("ERROR: (%s) %s @ line: %d col: %d\n", 57 | parser.context, parser.problem, m.line, m.column) 58 | } 59 | } 60 | fmt.Printf("%s (%d tokens)\n", msg, count) 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /flow/flow_as_helper_test.go: -------------------------------------------------------------------------------- 1 | package flow 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | 7 | "github.com/cloudfoundry-incubator/candiedyaml" 8 | "github.com/cloudfoundry-incubator/spiff/yaml" 9 | ) 10 | 11 | func FlowAs(expected yaml.Node, stubs ...yaml.Node) *FlowAsMatcher { 12 | return &FlowAsMatcher{Expected: expected, Stubs: stubs} 13 | } 14 | 15 | type FlowAsMatcher struct { 16 | Expected yaml.Node 17 | Stubs []yaml.Node 18 | actual yaml.Node 19 | } 20 | 21 | func (matcher *FlowAsMatcher) Match(source interface{}) (success bool, err error) { 22 | if source == nil && matcher.Expected == nil { 23 | return false, fmt.Errorf("Refusing to compare to .") 24 | } 25 | 26 | matcher.actual, err = Flow(source.(yaml.Node), matcher.Stubs...) 27 | if err != nil { 28 | return false, err 29 | } 30 | 31 | if matcher.actual.EquivalentToNode(matcher.Expected) { 32 | return true, nil 33 | } else { 34 | return false, nil 35 | } 36 | 37 | return 38 | } 39 | 40 | func formatMessage(actual yaml.Node, message string, expected yaml.Node) string { 41 | return fmt.Sprintf("Expected%s\n%s%s", formatYAML(actual), message, formatYAML(expected)) 42 | } 43 | 44 | func formatYAML(yaml yaml.Node) string { 45 | formatted, err := candiedyaml.Marshal(yaml) 46 | if err != nil { 47 | return fmt.Sprintf("\n\t<%T> %#v", yaml, yaml) 48 | } 49 | 50 | return fmt.Sprintf("\n\t%s", strings.Replace(string(formatted), "\n", "\n\t", -1)) 51 | } 52 | 53 | func (matcher *FlowAsMatcher) FailureMessage(actual interface{}) (message string) { 54 | return formatMessage(matcher.actual, "to flow as", matcher.Expected) 55 | } 56 | 57 | func (matcher *FlowAsMatcher) NegatedFailureMessage(actual interface{}) (message string) { 58 | return formatMessage(matcher.actual, "not to flow as", matcher.Expected) 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/stenographer/console_logging.go: -------------------------------------------------------------------------------- 1 | package stenographer 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | func (s *consoleStenographer) colorize(colorCode string, format string, args ...interface{}) string { 9 | var out string 10 | 11 | if len(args) > 0 { 12 | out = fmt.Sprintf(format, args...) 13 | } else { 14 | out = format 15 | } 16 | 17 | if s.color { 18 | return fmt.Sprintf("%s%s%s", colorCode, out, defaultStyle) 19 | } else { 20 | return out 21 | } 22 | } 23 | 24 | func (s *consoleStenographer) printBanner(text string, bannerCharacter string) { 25 | fmt.Println(text) 26 | fmt.Println(strings.Repeat(bannerCharacter, len(text))) 27 | } 28 | 29 | func (s *consoleStenographer) printNewLine() { 30 | fmt.Println("") 31 | } 32 | 33 | func (s *consoleStenographer) printDelimiter() { 34 | fmt.Println(s.colorize(grayColor, "%s", strings.Repeat("-", 30))) 35 | } 36 | 37 | func (s *consoleStenographer) print(indentation int, format string, args ...interface{}) { 38 | fmt.Print(s.indent(indentation, format, args...)) 39 | } 40 | 41 | func (s *consoleStenographer) println(indentation int, format string, args ...interface{}) { 42 | fmt.Println(s.indent(indentation, format, args...)) 43 | } 44 | 45 | func (s *consoleStenographer) indent(indentation int, format string, args ...interface{}) string { 46 | var text string 47 | 48 | if len(args) > 0 { 49 | text = fmt.Sprintf(format, args...) 50 | } else { 51 | text = format 52 | } 53 | 54 | stringArray := strings.Split(text, "\n") 55 | padding := "" 56 | if indentation >= 0 { 57 | padding = strings.Repeat(" ", indentation) 58 | } 59 | for i, s := range stringArray { 60 | stringArray[i] = fmt.Sprintf("%s%s", padding, s) 61 | } 62 | 63 | return strings.Join(stringArray, "\n") 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/notifications.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "os/exec" 7 | 8 | "github.com/onsi/ginkgo/ginkgo/testsuite" 9 | ) 10 | 11 | type Notifier struct { 12 | commandFlags *RunWatchAndBuildCommandFlags 13 | } 14 | 15 | func NewNotifier(commandFlags *RunWatchAndBuildCommandFlags) *Notifier { 16 | return &Notifier{ 17 | commandFlags: commandFlags, 18 | } 19 | } 20 | 21 | func (n *Notifier) VerifyNotificationsAreAvailable() { 22 | if n.commandFlags.Notify { 23 | _, err := exec.LookPath("terminal-notifier") 24 | if err != nil { 25 | fmt.Printf(`--notify requires terminal-notifier, which you don't seem to have installed. 26 | 27 | To remedy this: 28 | 29 | brew install terminal-notifier 30 | 31 | To learn more about terminal-notifier: 32 | 33 | https://github.com/alloy/terminal-notifier 34 | `) 35 | os.Exit(1) 36 | } 37 | } 38 | } 39 | 40 | func (n *Notifier) SendSuiteCompletionNotification(suite testsuite.TestSuite, suitePassed bool) { 41 | if suitePassed { 42 | n.SendNotification("Ginkgo [PASS]", fmt.Sprintf(`Test suite for "%s" passed.`, suite.PackageName)) 43 | } else { 44 | n.SendNotification("Ginkgo [FAIL]", fmt.Sprintf(`Test suite for "%s" failed.`, suite.PackageName)) 45 | } 46 | } 47 | 48 | func (n *Notifier) SendNotification(title string, subtitle string) { 49 | args := []string{"-title", title, "-subtitle", subtitle, "-group", "com.onsi.ginkgo"} 50 | 51 | terminal := os.Getenv("TERM_PROGRAM") 52 | if terminal == "iTerm.app" { 53 | args = append(args, "-activate", "com.googlecode.iterm2") 54 | } else if terminal == "Apple_Terminal" { 55 | args = append(args, "-activate", "com.apple.Terminal") 56 | } 57 | 58 | if n.commandFlags.Notify { 59 | exec.Command("terminal-notifier", args...).Run() 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/watch/package_hashes.go: -------------------------------------------------------------------------------- 1 | package watch 2 | 3 | import ( 4 | "path/filepath" 5 | "sync" 6 | ) 7 | 8 | type PackageHashes struct { 9 | PackageHashes map[string]*PackageHash 10 | usedPaths map[string]bool 11 | lock *sync.Mutex 12 | } 13 | 14 | func NewPackageHashes() *PackageHashes { 15 | return &PackageHashes{ 16 | PackageHashes: map[string]*PackageHash{}, 17 | usedPaths: nil, 18 | lock: &sync.Mutex{}, 19 | } 20 | } 21 | 22 | func (p *PackageHashes) CheckForChanges() []string { 23 | p.lock.Lock() 24 | defer p.lock.Unlock() 25 | 26 | modified := []string{} 27 | 28 | for _, packageHash := range p.PackageHashes { 29 | if packageHash.CheckForChanges() { 30 | modified = append(modified, packageHash.path) 31 | } 32 | } 33 | 34 | return modified 35 | } 36 | 37 | func (p *PackageHashes) Add(path string) *PackageHash { 38 | p.lock.Lock() 39 | defer p.lock.Unlock() 40 | 41 | path, _ = filepath.Abs(path) 42 | _, ok := p.PackageHashes[path] 43 | if !ok { 44 | p.PackageHashes[path] = NewPackageHash(path) 45 | } 46 | 47 | if p.usedPaths != nil { 48 | p.usedPaths[path] = true 49 | } 50 | return p.PackageHashes[path] 51 | } 52 | 53 | func (p *PackageHashes) Get(path string) *PackageHash { 54 | p.lock.Lock() 55 | defer p.lock.Unlock() 56 | 57 | path, _ = filepath.Abs(path) 58 | if p.usedPaths != nil { 59 | p.usedPaths[path] = true 60 | } 61 | return p.PackageHashes[path] 62 | } 63 | 64 | func (p *PackageHashes) StartTrackingUsage() { 65 | p.lock.Lock() 66 | defer p.lock.Unlock() 67 | 68 | p.usedPaths = map[string]bool{} 69 | } 70 | 71 | func (p *PackageHashes) StopTrackingUsageAndPrune() { 72 | p.lock.Lock() 73 | defer p.lock.Unlock() 74 | 75 | for path := range p.PackageHashes { 76 | if !p.usedPaths[path] { 77 | delete(p.PackageHashes, path) 78 | } 79 | } 80 | 81 | p.usedPaths = nil 82 | } 83 | -------------------------------------------------------------------------------- /yaml/find.go: -------------------------------------------------------------------------------- 1 | package yaml 2 | 3 | import ( 4 | "regexp" 5 | "strconv" 6 | ) 7 | 8 | var listIndex = regexp.MustCompile(`^\[(\d+)\]$`) 9 | 10 | func Find(root Node, path ...string) (Node, bool) { 11 | here := root 12 | 13 | for _, step := range path { 14 | if here == nil { 15 | return nil, false 16 | } 17 | 18 | var found bool 19 | 20 | here, found = nextStep(step, here) 21 | if !found { 22 | return nil, false 23 | } 24 | } 25 | 26 | return here, true 27 | } 28 | 29 | func FindString(root Node, path ...string) (string, bool) { 30 | node, ok := Find(root, path...) 31 | if !ok { 32 | return "", false 33 | } 34 | 35 | val, ok := node.Value().(string) 36 | return val, ok 37 | } 38 | 39 | func FindInt(root Node, path ...string) (int64, bool) { 40 | node, ok := Find(root, path...) 41 | if !ok { 42 | return 0, false 43 | } 44 | 45 | val, ok := node.Value().(int64) 46 | return val, ok 47 | } 48 | 49 | func nextStep(step string, here Node) (Node, bool) { 50 | found := false 51 | 52 | switch v := here.Value().(type) { 53 | case map[string]Node: 54 | here, found = v[step] 55 | case []Node: 56 | here, found = stepThroughList(v, step) 57 | default: 58 | } 59 | 60 | return here, found 61 | } 62 | 63 | func stepThroughList(here []Node, step string) (Node, bool) { 64 | match := listIndex.FindStringSubmatch(step) 65 | if match != nil { 66 | index, err := strconv.Atoi(match[1]) 67 | if err != nil { 68 | panic(err) 69 | } 70 | 71 | if len(here) <= index { 72 | return nil, false 73 | } 74 | 75 | return here[index], true 76 | } 77 | 78 | for _, sub := range here { 79 | _, ok := sub.Value().(map[string]Node) 80 | if !ok { 81 | continue 82 | } 83 | 84 | name, ok := FindString(sub, "name") 85 | if !ok { 86 | continue 87 | } 88 | 89 | if name == step { 90 | return sub, true 91 | } 92 | } 93 | 94 | return nil, false 95 | } 96 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/remote/output_interceptor_test.go: -------------------------------------------------------------------------------- 1 | package remote_test 2 | 3 | import ( 4 | "fmt" 5 | . "github.com/onsi/ginkgo" 6 | . "github.com/onsi/ginkgo/internal/remote" 7 | . "github.com/onsi/gomega" 8 | "os" 9 | ) 10 | 11 | var _ = Describe("OutputInterceptor", func() { 12 | var interceptor OutputInterceptor 13 | 14 | BeforeEach(func() { 15 | interceptor = NewOutputInterceptor() 16 | }) 17 | 18 | It("should capture all stdout/stderr output", func() { 19 | err := interceptor.StartInterceptingOutput() 20 | Ω(err).ShouldNot(HaveOccurred()) 21 | 22 | fmt.Fprint(os.Stdout, "STDOUT") 23 | fmt.Fprint(os.Stderr, "STDERR") 24 | print("PRINT") 25 | 26 | output, err := interceptor.StopInterceptingAndReturnOutput() 27 | 28 | Ω(output).Should(Equal("STDOUTSTDERRPRINT")) 29 | Ω(err).ShouldNot(HaveOccurred()) 30 | }) 31 | 32 | It("should error if told to intercept output twice", func() { 33 | err := interceptor.StartInterceptingOutput() 34 | Ω(err).ShouldNot(HaveOccurred()) 35 | 36 | print("A") 37 | 38 | err = interceptor.StartInterceptingOutput() 39 | Ω(err).Should(HaveOccurred()) 40 | 41 | print("B") 42 | 43 | output, err := interceptor.StopInterceptingAndReturnOutput() 44 | 45 | Ω(output).Should(Equal("AB")) 46 | Ω(err).ShouldNot(HaveOccurred()) 47 | }) 48 | 49 | It("should allow multiple interception sessions", func() { 50 | err := interceptor.StartInterceptingOutput() 51 | Ω(err).ShouldNot(HaveOccurred()) 52 | print("A") 53 | output, err := interceptor.StopInterceptingAndReturnOutput() 54 | Ω(output).Should(Equal("A")) 55 | Ω(err).ShouldNot(HaveOccurred()) 56 | 57 | err = interceptor.StartInterceptingOutput() 58 | Ω(err).ShouldNot(HaveOccurred()) 59 | print("B") 60 | output, err = interceptor.StopInterceptingAndReturnOutput() 61 | Ω(output).Should(Equal("B")) 62 | Ω(err).ShouldNot(HaveOccurred()) 63 | }) 64 | }) 65 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/build_command.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "os" 7 | "path/filepath" 8 | 9 | "github.com/onsi/ginkgo/ginkgo/interrupthandler" 10 | "github.com/onsi/ginkgo/ginkgo/testrunner" 11 | ) 12 | 13 | func BuildBuildCommand() *Command { 14 | commandFlags := NewBuildCommandFlags(flag.NewFlagSet("build", flag.ExitOnError)) 15 | interruptHandler := interrupthandler.NewInterruptHandler() 16 | builder := &SpecBuilder{ 17 | commandFlags: commandFlags, 18 | interruptHandler: interruptHandler, 19 | } 20 | 21 | return &Command{ 22 | Name: "build", 23 | FlagSet: commandFlags.FlagSet, 24 | UsageCommand: "ginkgo build ", 25 | Usage: []string{ 26 | "Build the passed in (or the package in the current directory if left blank).", 27 | "Accepts the following flags:", 28 | }, 29 | Command: builder.BuildSpecs, 30 | } 31 | } 32 | 33 | type SpecBuilder struct { 34 | commandFlags *RunWatchAndBuildCommandFlags 35 | interruptHandler *interrupthandler.InterruptHandler 36 | } 37 | 38 | func (r *SpecBuilder) BuildSpecs(args []string, additionalArgs []string) { 39 | r.commandFlags.computeNodes() 40 | 41 | suites, _ := findSuites(args, r.commandFlags.Recurse, r.commandFlags.SkipPackage, false) 42 | 43 | if len(suites) == 0 { 44 | complainAndQuit("Found no test suites") 45 | } 46 | 47 | passed := true 48 | for _, suite := range suites { 49 | runner := testrunner.New(suite, 1, false, r.commandFlags.Race, r.commandFlags.Cover, r.commandFlags.Tags, nil) 50 | fmt.Printf("Compiling %s...\n", suite.PackageName) 51 | err := runner.Compile() 52 | if err != nil { 53 | fmt.Println(err.Error()) 54 | passed = false 55 | } else { 56 | fmt.Printf(" compiled %s.test\n", filepath.Join(suite.Path, suite.PackageName)) 57 | } 58 | } 59 | 60 | if passed { 61 | os.Exit(0) 62 | } 63 | os.Exit(1) 64 | } 65 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/ginkgo/watch/delta_tracker.go: -------------------------------------------------------------------------------- 1 | package watch 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/onsi/ginkgo/ginkgo/testsuite" 7 | ) 8 | 9 | type SuiteErrors map[testsuite.TestSuite]error 10 | 11 | type DeltaTracker struct { 12 | maxDepth int 13 | suites map[string]*Suite 14 | packageHashes *PackageHashes 15 | } 16 | 17 | func NewDeltaTracker(maxDepth int) *DeltaTracker { 18 | return &DeltaTracker{ 19 | maxDepth: maxDepth, 20 | packageHashes: NewPackageHashes(), 21 | suites: map[string]*Suite{}, 22 | } 23 | } 24 | 25 | func (d *DeltaTracker) Delta(suites []testsuite.TestSuite) (delta Delta, errors SuiteErrors) { 26 | errors = SuiteErrors{} 27 | delta.ModifiedPackages = d.packageHashes.CheckForChanges() 28 | 29 | providedSuitePaths := map[string]bool{} 30 | for _, suite := range suites { 31 | providedSuitePaths[suite.Path] = true 32 | } 33 | 34 | d.packageHashes.StartTrackingUsage() 35 | 36 | for _, suite := range d.suites { 37 | if providedSuitePaths[suite.Suite.Path] { 38 | if suite.Delta() > 0 { 39 | delta.modifiedSuites = append(delta.modifiedSuites, suite) 40 | } 41 | } else { 42 | delta.RemovedSuites = append(delta.RemovedSuites, suite) 43 | } 44 | } 45 | 46 | d.packageHashes.StopTrackingUsageAndPrune() 47 | 48 | for _, suite := range suites { 49 | _, ok := d.suites[suite.Path] 50 | if !ok { 51 | s, err := NewSuite(suite, d.maxDepth, d.packageHashes) 52 | if err != nil { 53 | errors[suite] = err 54 | continue 55 | } 56 | d.suites[suite.Path] = s 57 | delta.NewSuites = append(delta.NewSuites, s) 58 | } 59 | } 60 | 61 | return delta, errors 62 | } 63 | 64 | func (d *DeltaTracker) WillRun(suite testsuite.TestSuite) error { 65 | s, ok := d.suites[suite.Path] 66 | if !ok { 67 | return fmt.Errorf("unknown suite %s", suite.Path) 68 | } 69 | 70 | return s.MarkAsRunAndRecomputedDependencies(d.maxDepth) 71 | } 72 | -------------------------------------------------------------------------------- /flow/unresolved_check.go: -------------------------------------------------------------------------------- 1 | package flow 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | 7 | "github.com/cloudfoundry-incubator/spiff/dynaml" 8 | "github.com/cloudfoundry-incubator/spiff/yaml" 9 | ) 10 | 11 | type UnresolvedNodes struct { 12 | Nodes []UnresolvedNode 13 | } 14 | 15 | type UnresolvedNode struct { 16 | yaml.Node 17 | 18 | Context []string 19 | Path []string 20 | } 21 | 22 | func (e UnresolvedNodes) Error() string { 23 | message := "unresolved nodes:" 24 | 25 | for _, node := range e.Nodes { 26 | message = fmt.Sprintf( 27 | "%s\n\t(( %s ))\tin %s\t%s\t(%s)", 28 | message, 29 | node.Value(), 30 | node.SourceName(), 31 | strings.Join(node.Context, "."), 32 | strings.Join(node.Path, "."), 33 | ) 34 | } 35 | 36 | return message 37 | } 38 | 39 | func findUnresolvedNodes(root yaml.Node, context ...string) (nodes []UnresolvedNode) { 40 | if root == nil { 41 | return nodes 42 | } 43 | 44 | switch val := root.Value().(type) { 45 | case map[string]yaml.Node: 46 | for key, val := range val { 47 | nodes = append( 48 | nodes, 49 | findUnresolvedNodes(val, addContext(context, key)...)..., 50 | ) 51 | } 52 | 53 | case []yaml.Node: 54 | for i, val := range val { 55 | context := addContext(context, fmt.Sprintf("[%d]", i)) 56 | 57 | nodes = append( 58 | nodes, 59 | findUnresolvedNodes(val, context...)..., 60 | ) 61 | } 62 | 63 | case dynaml.Expression: 64 | var path []string 65 | switch val := root.Value().(type) { 66 | case dynaml.AutoExpr: 67 | path = val.Path 68 | case dynaml.MergeExpr: 69 | path = val.Path 70 | } 71 | 72 | nodes = append(nodes, UnresolvedNode{ 73 | Node: root, 74 | Context: context, 75 | Path: path, 76 | }) 77 | } 78 | 79 | return nodes 80 | } 81 | 82 | func addContext(context []string, step string) []string { 83 | dup := make([]string, len(context)) 84 | copy(dup, context) 85 | return append(dup, step) 86 | } 87 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/testingtproxy/testing_t_proxy.go: -------------------------------------------------------------------------------- 1 | package testingtproxy 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | ) 7 | 8 | type failFunc func(message string, callerSkip ...int) 9 | 10 | func New(writer io.Writer, fail failFunc, offset int) *ginkgoTestingTProxy { 11 | return &ginkgoTestingTProxy{ 12 | fail: fail, 13 | offset: offset, 14 | writer: writer, 15 | } 16 | } 17 | 18 | type ginkgoTestingTProxy struct { 19 | fail failFunc 20 | offset int 21 | writer io.Writer 22 | } 23 | 24 | func (t *ginkgoTestingTProxy) Error(args ...interface{}) { 25 | t.fail(fmt.Sprintln(args...), t.offset) 26 | } 27 | 28 | func (t *ginkgoTestingTProxy) Errorf(format string, args ...interface{}) { 29 | t.fail(fmt.Sprintf(format, args...), t.offset) 30 | } 31 | 32 | func (t *ginkgoTestingTProxy) Fail() { 33 | t.fail("failed", t.offset) 34 | } 35 | 36 | func (t *ginkgoTestingTProxy) FailNow() { 37 | t.fail("failed", t.offset) 38 | } 39 | 40 | func (t *ginkgoTestingTProxy) Fatal(args ...interface{}) { 41 | t.fail(fmt.Sprintln(args...), t.offset) 42 | } 43 | 44 | func (t *ginkgoTestingTProxy) Fatalf(format string, args ...interface{}) { 45 | t.fail(fmt.Sprintf(format, args...), t.offset) 46 | } 47 | 48 | func (t *ginkgoTestingTProxy) Log(args ...interface{}) { 49 | fmt.Fprintln(t.writer, args...) 50 | } 51 | 52 | func (t *ginkgoTestingTProxy) Logf(format string, args ...interface{}) { 53 | fmt.Fprintf(t.writer, format, args...) 54 | } 55 | 56 | func (t *ginkgoTestingTProxy) Failed() bool { 57 | return false 58 | } 59 | 60 | func (t *ginkgoTestingTProxy) Parallel() { 61 | } 62 | 63 | func (t *ginkgoTestingTProxy) Skip(args ...interface{}) { 64 | fmt.Println(args...) 65 | } 66 | 67 | func (t *ginkgoTestingTProxy) Skipf(format string, args ...interface{}) { 68 | fmt.Printf(format, args...) 69 | } 70 | 71 | func (t *ginkgoTestingTProxy) SkipNow() { 72 | } 73 | 74 | func (t *ginkgoTestingTProxy) Skipped() bool { 75 | return false 76 | } 77 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/spec/index_computer.go: -------------------------------------------------------------------------------- 1 | package spec 2 | 3 | func ParallelizedIndexRange(length int, parallelTotal int, parallelNode int) (startIndex int, count int) { 4 | if length == 0 { 5 | return 0, 0 6 | } 7 | 8 | // We have more nodes than tests. Trivial case. 9 | if parallelTotal >= length { 10 | if parallelNode > length { 11 | return 0, 0 12 | } else { 13 | return parallelNode - 1, 1 14 | } 15 | } 16 | 17 | // This is the minimum amount of tests that a node will be required to run 18 | minTestsPerNode := length / parallelTotal 19 | 20 | // This is the maximum amount of tests that a node will be required to run 21 | // The algorithm guarantees that this would be equal to at least the minimum amount 22 | // and at most one more 23 | maxTestsPerNode := minTestsPerNode 24 | if length%parallelTotal != 0 { 25 | maxTestsPerNode++ 26 | } 27 | 28 | // Number of nodes that will have to run the maximum amount of tests per node 29 | numMaxLoadNodes := length % parallelTotal 30 | 31 | // Number of nodes that precede the current node and will have to run the maximum amount of tests per node 32 | var numPrecedingMaxLoadNodes int 33 | if parallelNode > numMaxLoadNodes { 34 | numPrecedingMaxLoadNodes = numMaxLoadNodes 35 | } else { 36 | numPrecedingMaxLoadNodes = parallelNode - 1 37 | } 38 | 39 | // Number of nodes that precede the current node and will have to run the minimum amount of tests per node 40 | var numPrecedingMinLoadNodes int 41 | if parallelNode <= numMaxLoadNodes { 42 | numPrecedingMinLoadNodes = 0 43 | } else { 44 | numPrecedingMinLoadNodes = parallelNode - numMaxLoadNodes - 1 45 | } 46 | 47 | // Evaluate the test start index and number of tests to run 48 | startIndex = numPrecedingMaxLoadNodes*maxTestsPerNode + numPrecedingMinLoadNodes*minTestsPerNode 49 | if parallelNode > numMaxLoadNodes { 50 | count = minTestsPerNode 51 | } else { 52 | count = maxTestsPerNode 53 | } 54 | return 55 | } 56 | -------------------------------------------------------------------------------- /yaml/node.go: -------------------------------------------------------------------------------- 1 | package yaml 2 | 3 | import ( 4 | "reflect" 5 | 6 | "github.com/cloudfoundry-incubator/candiedyaml" 7 | ) 8 | 9 | type Node interface { 10 | candiedyaml.Marshaler 11 | 12 | Value() interface{} 13 | SourceName() string 14 | EquivalentToNode(Node) bool 15 | } 16 | 17 | type AnnotatedNode struct { 18 | value interface{} 19 | sourceName string 20 | } 21 | 22 | func NewNode(value interface{}, sourcePath string) Node { 23 | return AnnotatedNode{massageType(value), sourcePath} 24 | } 25 | 26 | func massageType(value interface{}) interface{} { 27 | switch value.(type) { 28 | case int, int8, int16, int32: 29 | value = reflect.ValueOf(value).Int() 30 | } 31 | return value 32 | } 33 | 34 | func (n AnnotatedNode) Value() interface{} { 35 | return n.value 36 | } 37 | 38 | func (n AnnotatedNode) SourceName() string { 39 | return n.sourceName 40 | } 41 | 42 | func (n AnnotatedNode) MarshalYAML() (string, interface{}) { 43 | return "", n.Value() 44 | } 45 | 46 | func (n AnnotatedNode) EquivalentToNode(o Node) bool { 47 | if o == nil { 48 | return false 49 | } 50 | 51 | at := reflect.TypeOf(n.Value()) 52 | bt := reflect.TypeOf(o.Value()) 53 | 54 | if at != bt { 55 | return false 56 | } 57 | 58 | switch nv := n.Value().(type) { 59 | case map[string]Node: 60 | ov := o.Value().(map[string]Node) 61 | 62 | if len(nv) != len(ov) { 63 | return false 64 | } 65 | 66 | for key, nval := range nv { 67 | oval, found := ov[key] 68 | if !found { 69 | return false 70 | } 71 | 72 | if !nval.EquivalentToNode(oval) { 73 | return false 74 | } 75 | } 76 | 77 | return true 78 | 79 | case []Node: 80 | ov := o.Value().([]Node) 81 | 82 | if len(nv) != len(ov) { 83 | return false 84 | } 85 | 86 | for i, nval := range nv { 87 | oval := ov[i] 88 | 89 | if !nval.EquivalentToNode(oval) { 90 | return false 91 | } 92 | } 93 | 94 | return true 95 | } 96 | 97 | return reflect.DeepEqual(n.Value(), o.Value()) 98 | } 99 | -------------------------------------------------------------------------------- /dynaml/or_test.go: -------------------------------------------------------------------------------- 1 | package dynaml 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | 7 | "github.com/cloudfoundry-incubator/spiff/yaml" 8 | ) 9 | 10 | var _ = Describe("or", func() { 11 | Context("when both sides fail", func() { 12 | It("fails", func() { 13 | expr := OrExpr{ 14 | FailingExpr{}, 15 | FailingExpr{}, 16 | } 17 | 18 | Expect(expr).To(FailToEvaluate(FakeBinding{})) 19 | }) 20 | }) 21 | 22 | Context("when the left-hand side fails", func() { 23 | It("returns the right-hand side", func() { 24 | expr := OrExpr{ 25 | FailingExpr{}, 26 | IntegerExpr{2}, 27 | } 28 | 29 | Expect(expr).To(EvaluateAs(2, FakeBinding{})) 30 | }) 31 | }) 32 | 33 | Context("when the right-hand side fails", func() { 34 | It("returns the left-hand side", func() { 35 | expr := OrExpr{ 36 | IntegerExpr{1}, 37 | FailingExpr{}, 38 | } 39 | 40 | Expect(expr).To(EvaluateAs(1, FakeBinding{})) 41 | }) 42 | }) 43 | 44 | Context("when the left-hand side is nil", func() { 45 | It("returns the left-hand side", func() { 46 | expr := OrExpr{ 47 | NilExpr{}, 48 | FailingExpr{}, 49 | } 50 | 51 | Expect(expr).To(EvaluateAs(nil, FakeBinding{})) 52 | }) 53 | }) 54 | 55 | Context("when the right side is nil and the left fails", func() { 56 | It("returns the left-hand side", func() { 57 | expr := OrExpr{ 58 | FailingExpr{}, 59 | NilExpr{}, 60 | } 61 | 62 | Expect(expr).To(EvaluateAs(nil, FakeBinding{})) 63 | }) 64 | }) 65 | 66 | Context("when the left side evaluates to itself (i.e. reference)", func() { 67 | It("fails assuming the left hand side cannot be determined yet", func() { 68 | expr := OrExpr{ 69 | ReferenceExpr{[]string{"foo", "bar"}}, 70 | NilExpr{}, 71 | } 72 | 73 | binding := FakeBinding{ 74 | FoundReferences: map[string]yaml.Node{ 75 | "foo": node(MergeExpr{}), 76 | }, 77 | } 78 | 79 | Expect(expr).To(FailToEvaluate(binding)) 80 | }) 81 | }) 82 | }) 83 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/match_json_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "bytes" 5 | "encoding/json" 6 | "fmt" 7 | "github.com/onsi/gomega/format" 8 | "reflect" 9 | ) 10 | 11 | type MatchJSONMatcher struct { 12 | JSONToMatch interface{} 13 | } 14 | 15 | func (matcher *MatchJSONMatcher) Match(actual interface{}) (success bool, err error) { 16 | actualString, expectedString, err := matcher.prettyPrint(actual) 17 | if err != nil { 18 | return false, err 19 | } 20 | 21 | var aval interface{} 22 | var eval interface{} 23 | 24 | // this is guarded by prettyPrint 25 | json.Unmarshal([]byte(actualString), &aval) 26 | json.Unmarshal([]byte(expectedString), &eval) 27 | 28 | return reflect.DeepEqual(aval, eval), nil 29 | } 30 | 31 | func (matcher *MatchJSONMatcher) FailureMessage(actual interface{}) (message string) { 32 | actualString, expectedString, _ := matcher.prettyPrint(actual) 33 | return format.Message(actualString, "to match JSON of", expectedString) 34 | } 35 | 36 | func (matcher *MatchJSONMatcher) NegatedFailureMessage(actual interface{}) (message string) { 37 | actualString, expectedString, _ := matcher.prettyPrint(actual) 38 | return format.Message(actualString, "not to match JSON of", expectedString) 39 | } 40 | 41 | func (matcher *MatchJSONMatcher) prettyPrint(actual interface{}) (actualFormatted, expectedFormatted string, err error) { 42 | actualString, aok := toString(actual) 43 | expectedString, eok := toString(matcher.JSONToMatch) 44 | 45 | if !(aok && eok) { 46 | return "", "", fmt.Errorf("MatchJSONMatcher matcher requires a string or stringer. Got:\n%s", format.Object(actual, 1)) 47 | } 48 | 49 | abuf := new(bytes.Buffer) 50 | ebuf := new(bytes.Buffer) 51 | 52 | if err := json.Indent(abuf, []byte(actualString), "", " "); err != nil { 53 | return "", "", err 54 | } 55 | 56 | if err := json.Indent(ebuf, []byte(expectedString), "", " "); err != nil { 57 | return "", "", err 58 | } 59 | 60 | return abuf.String(), ebuf.String(), nil 61 | } 62 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/reporters/fake_reporter.go: -------------------------------------------------------------------------------- 1 | package reporters 2 | 3 | import ( 4 | "github.com/onsi/ginkgo/config" 5 | "github.com/onsi/ginkgo/types" 6 | ) 7 | 8 | //FakeReporter is useful for testing purposes 9 | type FakeReporter struct { 10 | Config config.GinkgoConfigType 11 | 12 | BeginSummary *types.SuiteSummary 13 | BeforeSuiteSummary *types.SetupSummary 14 | SpecWillRunSummaries []*types.SpecSummary 15 | SpecSummaries []*types.SpecSummary 16 | AfterSuiteSummary *types.SetupSummary 17 | EndSummary *types.SuiteSummary 18 | 19 | SpecWillRunStub func(specSummary *types.SpecSummary) 20 | SpecDidCompleteStub func(specSummary *types.SpecSummary) 21 | } 22 | 23 | func NewFakeReporter() *FakeReporter { 24 | return &FakeReporter{ 25 | SpecWillRunSummaries: make([]*types.SpecSummary, 0), 26 | SpecSummaries: make([]*types.SpecSummary, 0), 27 | } 28 | } 29 | 30 | func (fakeR *FakeReporter) SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary) { 31 | fakeR.Config = config 32 | fakeR.BeginSummary = summary 33 | } 34 | 35 | func (fakeR *FakeReporter) BeforeSuiteDidRun(setupSummary *types.SetupSummary) { 36 | fakeR.BeforeSuiteSummary = setupSummary 37 | } 38 | 39 | func (fakeR *FakeReporter) SpecWillRun(specSummary *types.SpecSummary) { 40 | if fakeR.SpecWillRunStub != nil { 41 | fakeR.SpecWillRunStub(specSummary) 42 | } 43 | fakeR.SpecWillRunSummaries = append(fakeR.SpecWillRunSummaries, specSummary) 44 | } 45 | 46 | func (fakeR *FakeReporter) SpecDidComplete(specSummary *types.SpecSummary) { 47 | if fakeR.SpecDidCompleteStub != nil { 48 | fakeR.SpecDidCompleteStub(specSummary) 49 | } 50 | fakeR.SpecSummaries = append(fakeR.SpecSummaries, specSummary) 51 | } 52 | 53 | func (fakeR *FakeReporter) AfterSuiteDidRun(setupSummary *types.SetupSummary) { 54 | fakeR.AfterSuiteSummary = setupSummary 55 | } 56 | 57 | func (fakeR *FakeReporter) SpecSuiteDidEnd(summary *types.SuiteSummary) { 58 | fakeR.EndSummary = summary 59 | } 60 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go: -------------------------------------------------------------------------------- 1 | package matchers 2 | 3 | import ( 4 | "fmt" 5 | "github.com/onsi/gomega/format" 6 | "time" 7 | ) 8 | 9 | type BeTemporallyMatcher struct { 10 | Comparator string 11 | CompareTo time.Time 12 | Threshold []time.Duration 13 | } 14 | 15 | func (matcher *BeTemporallyMatcher) FailureMessage(actual interface{}) (message string) { 16 | return format.Message(actual, fmt.Sprintf("to be %s", matcher.Comparator), matcher.CompareTo) 17 | } 18 | 19 | func (matcher *BeTemporallyMatcher) NegatedFailureMessage(actual interface{}) (message string) { 20 | return format.Message(actual, fmt.Sprintf("not to be %s", matcher.Comparator), matcher.CompareTo) 21 | } 22 | 23 | func (matcher *BeTemporallyMatcher) Match(actual interface{}) (bool, error) { 24 | // predicate to test for time.Time type 25 | isTime := func(t interface{}) bool { 26 | _, ok := t.(time.Time) 27 | return ok 28 | } 29 | 30 | if !isTime(actual) { 31 | return false, fmt.Errorf("Expected a time.Time. Got:\n%s", format.Object(actual, 1)) 32 | } 33 | 34 | switch matcher.Comparator { 35 | case "==", "~", ">", ">=", "<", "<=": 36 | default: 37 | return false, fmt.Errorf("Unknown comparator: %s", matcher.Comparator) 38 | } 39 | 40 | var threshold = time.Millisecond 41 | if len(matcher.Threshold) == 1 { 42 | threshold = matcher.Threshold[0] 43 | } 44 | 45 | return matcher.matchTimes(actual.(time.Time), matcher.CompareTo, threshold), nil 46 | } 47 | 48 | func (matcher *BeTemporallyMatcher) matchTimes(actual, compareTo time.Time, threshold time.Duration) (success bool) { 49 | switch matcher.Comparator { 50 | case "==": 51 | return actual.Equal(compareTo) 52 | case "~": 53 | diff := actual.Sub(compareTo) 54 | return -threshold <= diff && diff <= threshold 55 | case ">": 56 | return actual.After(compareTo) 57 | case ">=": 58 | return !actual.Before(compareTo) 59 | case "<": 60 | return actual.Before(compareTo) 61 | case "<=": 62 | return !actual.After(compareTo) 63 | } 64 | return false 65 | } 66 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/equal_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | "errors" 5 | . "github.com/onsi/ginkgo" 6 | . "github.com/onsi/gomega" 7 | . "github.com/onsi/gomega/matchers" 8 | ) 9 | 10 | var _ = Describe("Equal", func() { 11 | Context("when asserting that nil equals nil", func() { 12 | It("should error", func() { 13 | success, err := (&EqualMatcher{Expected: nil}).Match(nil) 14 | 15 | Ω(success).Should(BeFalse()) 16 | Ω(err).Should(HaveOccurred()) 17 | }) 18 | }) 19 | 20 | Context("When asserting equality between objects", func() { 21 | It("should do the right thing", func() { 22 | Ω(5).Should(Equal(5)) 23 | Ω(5.0).Should(Equal(5.0)) 24 | 25 | Ω(5).ShouldNot(Equal("5")) 26 | Ω(5).ShouldNot(Equal(5.0)) 27 | Ω(5).ShouldNot(Equal(3)) 28 | 29 | Ω("5").Should(Equal("5")) 30 | Ω([]int{1, 2}).Should(Equal([]int{1, 2})) 31 | Ω([]int{1, 2}).ShouldNot(Equal([]int{2, 1})) 32 | Ω(map[string]string{"a": "b", "c": "d"}).Should(Equal(map[string]string{"a": "b", "c": "d"})) 33 | Ω(map[string]string{"a": "b", "c": "d"}).ShouldNot(Equal(map[string]string{"a": "b", "c": "e"})) 34 | Ω(errors.New("foo")).Should(Equal(errors.New("foo"))) 35 | Ω(errors.New("foo")).ShouldNot(Equal(errors.New("bar"))) 36 | 37 | Ω(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).Should(Equal(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}})) 38 | Ω(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "bar", n: 3, f: 2.0, arr: []string{"a", "b"}})) 39 | Ω(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "foo", n: 2, f: 2.0, arr: []string{"a", "b"}})) 40 | Ω(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "foo", n: 3, f: 3.0, arr: []string{"a", "b"}})) 41 | Ω(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b", "c"}})) 42 | }) 43 | }) 44 | }) 45 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/gomega/matchers/match_json_matcher_test.go: -------------------------------------------------------------------------------- 1 | package matchers_test 2 | 3 | import ( 4 | . "github.com/onsi/ginkgo" 5 | . "github.com/onsi/gomega" 6 | . "github.com/onsi/gomega/matchers" 7 | ) 8 | 9 | var _ = Describe("MatchJSONMatcher", func() { 10 | Context("When passed stringifiables", func() { 11 | It("should succeed if the JSON matches", func() { 12 | Ω("{}").Should(MatchJSON("{}")) 13 | Ω(`{"a":1}`).Should(MatchJSON(`{"a":1}`)) 14 | Ω(`{ 15 | "a":1 16 | }`).Should(MatchJSON(`{"a":1}`)) 17 | Ω(`{"a":1, "b":2}`).Should(MatchJSON(`{"b":2, "a":1}`)) 18 | Ω(`{"a":1}`).ShouldNot(MatchJSON(`{"b":2, "a":1}`)) 19 | }) 20 | 21 | It("should work with byte arrays", func() { 22 | Ω([]byte("{}")).Should(MatchJSON([]byte("{}"))) 23 | Ω("{}").Should(MatchJSON([]byte("{}"))) 24 | Ω([]byte("{}")).Should(MatchJSON("{}")) 25 | }) 26 | }) 27 | 28 | Context("when either side is not valid JSON", func() { 29 | It("should error", func() { 30 | success, err := (&MatchJSONMatcher{JSONToMatch: `oops`}).Match(`{}`) 31 | Ω(success).Should(BeFalse()) 32 | Ω(err).Should(HaveOccurred()) 33 | 34 | success, err = (&MatchJSONMatcher{JSONToMatch: `{}`}).Match(`oops`) 35 | Ω(success).Should(BeFalse()) 36 | Ω(err).Should(HaveOccurred()) 37 | }) 38 | }) 39 | 40 | Context("when either side is neither a string nor a stringer", func() { 41 | It("should error", func() { 42 | success, err := (&MatchJSONMatcher{JSONToMatch: "{}"}).Match(2) 43 | Ω(success).Should(BeFalse()) 44 | Ω(err).Should(HaveOccurred()) 45 | 46 | success, err = (&MatchJSONMatcher{JSONToMatch: 2}).Match("{}") 47 | Ω(success).Should(BeFalse()) 48 | Ω(err).Should(HaveOccurred()) 49 | 50 | success, err = (&MatchJSONMatcher{JSONToMatch: nil}).Match("{}") 51 | Ω(success).Should(BeFalse()) 52 | Ω(err).Should(HaveOccurred()) 53 | 54 | success, err = (&MatchJSONMatcher{JSONToMatch: 2}).Match(nil) 55 | Ω(success).Should(BeFalse()) 56 | Ω(err).Should(HaveOccurred()) 57 | }) 58 | }) 59 | }) 60 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/internal/failer/failer.go: -------------------------------------------------------------------------------- 1 | package failer 2 | 3 | import ( 4 | "fmt" 5 | "sync" 6 | 7 | "github.com/onsi/ginkgo/types" 8 | ) 9 | 10 | type Failer struct { 11 | lock *sync.Mutex 12 | failure types.SpecFailure 13 | state types.SpecState 14 | } 15 | 16 | func New() *Failer { 17 | return &Failer{ 18 | lock: &sync.Mutex{}, 19 | state: types.SpecStatePassed, 20 | } 21 | } 22 | 23 | func (f *Failer) Panic(location types.CodeLocation, forwardedPanic interface{}) { 24 | f.lock.Lock() 25 | defer f.lock.Unlock() 26 | 27 | if f.state == types.SpecStatePassed { 28 | f.state = types.SpecStatePanicked 29 | f.failure = types.SpecFailure{ 30 | Message: "Test Panicked", 31 | Location: location, 32 | ForwardedPanic: fmt.Sprintf("%v", forwardedPanic), 33 | } 34 | } 35 | } 36 | 37 | func (f *Failer) Timeout(location types.CodeLocation) { 38 | f.lock.Lock() 39 | defer f.lock.Unlock() 40 | 41 | if f.state == types.SpecStatePassed { 42 | f.state = types.SpecStateTimedOut 43 | f.failure = types.SpecFailure{ 44 | Message: "Timed out", 45 | Location: location, 46 | } 47 | } 48 | } 49 | 50 | func (f *Failer) Fail(message string, location types.CodeLocation) { 51 | f.lock.Lock() 52 | defer f.lock.Unlock() 53 | 54 | if f.state == types.SpecStatePassed { 55 | f.state = types.SpecStateFailed 56 | f.failure = types.SpecFailure{ 57 | Message: message, 58 | Location: location, 59 | } 60 | } 61 | } 62 | 63 | func (f *Failer) Drain(componentType types.SpecComponentType, componentIndex int, componentCodeLocation types.CodeLocation) (types.SpecFailure, types.SpecState) { 64 | f.lock.Lock() 65 | defer f.lock.Unlock() 66 | 67 | failure := f.failure 68 | outcome := f.state 69 | if outcome != types.SpecStatePassed { 70 | failure.ComponentType = componentType 71 | failure.ComponentIndex = componentIndex 72 | failure.ComponentCodeLocation = componentCodeLocation 73 | } 74 | 75 | f.state = types.SpecStatePassed 76 | f.failure = types.SpecFailure{} 77 | 78 | return failure, outcome 79 | } 80 | -------------------------------------------------------------------------------- /vendor/github.com/onsi/ginkgo/integration/precompiled_test.go: -------------------------------------------------------------------------------- 1 | package integration_test 2 | 3 | import ( 4 | "os" 5 | "os/exec" 6 | "path/filepath" 7 | 8 | . "github.com/onsi/ginkgo" 9 | . "github.com/onsi/gomega" 10 | "github.com/onsi/gomega/gbytes" 11 | "github.com/onsi/gomega/gexec" 12 | ) 13 | 14 | var _ = Describe("ginkgo build", func() { 15 | var pathToTest string 16 | 17 | BeforeEach(func() { 18 | pathToTest = tmpPath("passing_ginkgo_tests") 19 | copyIn("passing_ginkgo_tests", pathToTest) 20 | session := startGinkgo(pathToTest, "build") 21 | Eventually(session).Should(gexec.Exit(0)) 22 | output := string(session.Out.Contents()) 23 | Ω(output).Should(ContainSubstring("Compiling passing_ginkgo_tests")) 24 | Ω(output).Should(ContainSubstring("compiled passing_ginkgo_tests.test")) 25 | }) 26 | 27 | It("should build a test binary", func() { 28 | _, err := os.Stat(filepath.Join(pathToTest, "passing_ginkgo_tests.test")) 29 | Ω(err).ShouldNot(HaveOccurred()) 30 | }) 31 | 32 | It("should be possible to run the test binary directly", func() { 33 | cmd := exec.Command("./passing_ginkgo_tests.test") 34 | cmd.Dir = pathToTest 35 | session, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter) 36 | Ω(err).ShouldNot(HaveOccurred()) 37 | Eventually(session).Should(gexec.Exit(0)) 38 | Ω(session).Should(gbytes.Say("Running Suite: Passing_ginkgo_tests Suite")) 39 | }) 40 | 41 | It("should be possible to run the test binary via ginkgo", func() { 42 | session := startGinkgo(pathToTest, "./passing_ginkgo_tests.test") 43 | Eventually(session).Should(gexec.Exit(0)) 44 | Ω(session).Should(gbytes.Say("Running Suite: Passing_ginkgo_tests Suite")) 45 | }) 46 | 47 | It("should be possible to run the test binary in parallel", func() { 48 | session := startGinkgo(pathToTest, "--nodes=4", "--noColor", "./passing_ginkgo_tests.test") 49 | Eventually(session).Should(gexec.Exit(0)) 50 | Ω(session).Should(gbytes.Say("Running Suite: Passing_ginkgo_tests Suite")) 51 | Ω(session).Should(gbytes.Say("Running in parallel across 4 nodes")) 52 | }) 53 | }) 54 | --------------------------------------------------------------------------------