summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/hashicorp/hcl
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/hcl')
-rw-r--r--vendor/github.com/hashicorp/hcl/.github/ISSUE_TEMPLATE.md21
-rw-r--r--vendor/github.com/hashicorp/hcl/decoder_test.go1203
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/ast/ast_test.go200
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go162
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd_test.go440
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/.hidden.ignore1
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/dir.ignore0
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/file.ignore1
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/good.hcl0
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/error_test.go9
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/parser.go6
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/parser_test.go575
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/array_comment.hcl4
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/array_comment_2.hcl6
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/assign_colon.hcl6
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/assign_deep.hcl5
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment.hcl15
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment_crlf.hcl15
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment_lastline.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment_single.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/complex.hcl42
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/complex_crlf.hcl42
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/complex_key.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/empty.hcl0
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/git_crypt.hclbin10 -> 0 bytes
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/key_without_value.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/list.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/list_comma.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/missing_braces.hcl4
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/multiple.hcl2
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_assign_without_value.hcl3
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_assign_without_value2.hcl4
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_assign_without_value3.hcl4
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_without_value.hcl3
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_list_comma.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/old.hcl3
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/structure.hcl5
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/structure_basic.hcl5
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/structure_empty.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/types.hcl7
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/unterminated_object.hcl2
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/unterminated_object_2.hcl6
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go190
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/printer_test.go149
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.golden36
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.input37
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.golden32
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.input28
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.golden13
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.input13
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_crlf.input37
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.golden6
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.input5
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_indent.golden12
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_indent.input13
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_no_stanza.golden7
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_no_stanza.input6
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_stanza.golden10
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_stanza.input10
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_newline.golden3
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_newline.input2
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_object_multi.golden9
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_object_multi.input9
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.golden17
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.input16
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/complexhcl.golden54
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/complexhcl.input53
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/empty_block.golden12
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/empty_block.input14
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list.golden43
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list.input37
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_comment.golden7
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_comment.input6
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_of_objects.golden10
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_of_objects.input10
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/multiline_string.golden7
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/multiline_string.input7
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_singleline.golden26
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_singleline.input19
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_with_heredoc.golden6
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_with_heredoc.input6
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/scanner/scanner.go29
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/scanner/scanner_test.go591
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/strconv/quote_test.go96
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/test-fixtures/array_comment.hcl4
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/test-fixtures/assign_colon.hcl6
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment.hcl15
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment_single.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex.hcl42
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex_key.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/test-fixtures/empty.hcl0
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list_comma.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/test-fixtures/multiple.hcl2
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/test-fixtures/old.hcl3
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure.hcl5
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_basic.hcl5
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_empty.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/test-fixtures/types.hcl7
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/token/token_test.go69
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl_test.go19
-rw-r--r--vendor/github.com/hashicorp/hcl/json/parser/parser_test.go384
-rw-r--r--vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/array.json4
-rw-r--r--vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_128.json1
-rw-r--r--vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_tf_8110.json7
-rw-r--r--vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/basic.json3
-rw-r--r--vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/good_input_tf_8110.json7
-rw-r--r--vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/object.json5
-rw-r--r--vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/types.json10
-rw-r--r--vendor/github.com/hashicorp/hcl/json/scanner/scanner_test.go362
-rw-r--r--vendor/github.com/hashicorp/hcl/json/test-fixtures/array.json4
-rw-r--r--vendor/github.com/hashicorp/hcl/json/test-fixtures/basic.json3
-rw-r--r--vendor/github.com/hashicorp/hcl/json/test-fixtures/object.json5
-rw-r--r--vendor/github.com/hashicorp/hcl/json/test-fixtures/types.json10
-rw-r--r--vendor/github.com/hashicorp/hcl/json/token/token_test.go34
-rw-r--r--vendor/github.com/hashicorp/hcl/lex_test.go37
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/assign_deep.hcl5
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/basic.hcl2
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/basic.json4
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/basic_int_string.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/basic_squish.hcl3
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/block_assign.hcl2
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.hcl15
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.json19
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.hcl10
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.json14
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/empty.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/escape.hcl6
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/escape_backslash.hcl5
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/flat.hcl2
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/float.hcl2
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/float.json4
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/git_crypt.hclbin10 -> 0 bytes
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/interpolate.json3
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/list_of_lists.hcl2
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/list_of_maps.hcl4
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/multiline.hcl4
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/multiline.json3
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/multiline_bad.hcl4
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/multiline_indented.hcl4
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/multiline_literal.hcl2
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/multiline_literal_with_hil.hcl2
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/multiline_no_eof.hcl5
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/multiline_no_hanging_indent.hcl5
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/multiline_no_marker.hcl1
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/nested_block_comment.hcl5
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/nested_provider_bad.hcl5
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/null_strings.json7
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/object_list.json15
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/object_with_bool.hcl6
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/scientific.hcl6
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/scientific.json8
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/slice_expand.hcl7
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/structure.hcl5
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/structure.json8
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/structure2.hcl9
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/structure2.json10
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/structure_flat.json8
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/structure_flatmap.hcl7
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/structure_list.hcl6
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/structure_list.json7
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/structure_list_deep.json16
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/structure_list_empty.json3
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/structure_multi.hcl7
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/structure_multi.json11
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.hcl5
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.json6
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/terraform_variable_invalid.json5
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/tfvars.hcl3
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/unterminated_block_comment.hcl2
-rw-r--r--vendor/github.com/hashicorp/hcl/test-fixtures/unterminated_brace.hcl2
-rw-r--r--vendor/github.com/hashicorp/hcl/testhelper/unix2dos.go15
172 files changed, 121 insertions, 5767 deletions
diff --git a/vendor/github.com/hashicorp/hcl/.github/ISSUE_TEMPLATE.md b/vendor/github.com/hashicorp/hcl/.github/ISSUE_TEMPLATE.md
deleted file mode 100644
index 2d7fc4bf6..000000000
--- a/vendor/github.com/hashicorp/hcl/.github/ISSUE_TEMPLATE.md
+++ /dev/null
@@ -1,21 +0,0 @@
-### HCL Template
-```hcl
-# Place your HCL configuration file here
-```
-
-### Expected behavior
-What should have happened?
-
-### Actual behavior
-What actually happened?
-
-### Steps to reproduce
-1.
-2.
-3.
-
-### References
-Are there any other GitHub issues (open or closed) that should
-be linked here? For example:
-- GH-1234
-- ...
diff --git a/vendor/github.com/hashicorp/hcl/decoder_test.go b/vendor/github.com/hashicorp/hcl/decoder_test.go
deleted file mode 100644
index 8682f470e..000000000
--- a/vendor/github.com/hashicorp/hcl/decoder_test.go
+++ /dev/null
@@ -1,1203 +0,0 @@
-package hcl
-
-import (
- "io/ioutil"
- "path/filepath"
- "reflect"
- "testing"
- "time"
-
- "github.com/davecgh/go-spew/spew"
- "github.com/hashicorp/hcl/hcl/ast"
-)
-
-func TestDecode_interface(t *testing.T) {
- cases := []struct {
- File string
- Err bool
- Out interface{}
- }{
- {
- "basic.hcl",
- false,
- map[string]interface{}{
- "foo": "bar",
- "bar": "${file(\"bing/bong.txt\")}",
- },
- },
- {
- "basic_squish.hcl",
- false,
- map[string]interface{}{
- "foo": "bar",
- "bar": "${file(\"bing/bong.txt\")}",
- "foo-bar": "baz",
- },
- },
- {
- "empty.hcl",
- false,
- map[string]interface{}{
- "resource": []map[string]interface{}{
- map[string]interface{}{
- "foo": []map[string]interface{}{
- map[string]interface{}{},
- },
- },
- },
- },
- },
- {
- "tfvars.hcl",
- false,
- map[string]interface{}{
- "regularvar": "Should work",
- "map.key1": "Value",
- "map.key2": "Other value",
- },
- },
- {
- "escape.hcl",
- false,
- map[string]interface{}{
- "foo": "bar\"baz\\n",
- "qux": "back\\slash",
- "bar": "new\nline",
- "qax": `slash\:colon`,
- "nested": `${HH\\:mm\\:ss}`,
- "nestedquotes": `${"\"stringwrappedinquotes\""}`,
- },
- },
- {
- "float.hcl",
- false,
- map[string]interface{}{
- "a": 1.02,
- "b": 2,
- },
- },
- {
- "multiline_bad.hcl",
- true,
- nil,
- },
- {
- "multiline_literal.hcl",
- true,
- nil,
- },
- {
- "multiline_literal_with_hil.hcl",
- false,
- map[string]interface{}{"multiline_literal_with_hil": "${hello\n world}"},
- },
- {
- "multiline_no_marker.hcl",
- true,
- nil,
- },
- {
- "multiline.hcl",
- false,
- map[string]interface{}{"foo": "bar\nbaz\n"},
- },
- {
- "multiline_indented.hcl",
- false,
- map[string]interface{}{"foo": " bar\n baz\n"},
- },
- {
- "multiline_no_hanging_indent.hcl",
- false,
- map[string]interface{}{"foo": " baz\n bar\n foo\n"},
- },
- {
- "multiline_no_eof.hcl",
- false,
- map[string]interface{}{"foo": "bar\nbaz\n", "key": "value"},
- },
- {
- "multiline.json",
- false,
- map[string]interface{}{"foo": "bar\nbaz"},
- },
- {
- "null_strings.json",
- false,
- map[string]interface{}{
- "module": []map[string]interface{}{
- map[string]interface{}{
- "app": []map[string]interface{}{
- map[string]interface{}{"foo": ""},
- },
- },
- },
- },
- },
- {
- "scientific.json",
- false,
- map[string]interface{}{
- "a": 1e-10,
- "b": 1e+10,
- "c": 1e10,
- "d": 1.2e-10,
- "e": 1.2e+10,
- "f": 1.2e10,
- },
- },
- {
- "scientific.hcl",
- false,
- map[string]interface{}{
- "a": 1e-10,
- "b": 1e+10,
- "c": 1e10,
- "d": 1.2e-10,
- "e": 1.2e+10,
- "f": 1.2e10,
- },
- },
- {
- "terraform_heroku.hcl",
- false,
- map[string]interface{}{
- "name": "terraform-test-app",
- "config_vars": []map[string]interface{}{
- map[string]interface{}{
- "FOO": "bar",
- },
- },
- },
- },
- {
- "structure_multi.hcl",
- false,
- map[string]interface{}{
- "foo": []map[string]interface{}{
- map[string]interface{}{
- "baz": []map[string]interface{}{
- map[string]interface{}{"key": 7},
- },
- },
- map[string]interface{}{
- "bar": []map[string]interface{}{
- map[string]interface{}{"key": 12},
- },
- },
- },
- },
- },
- {
- "structure_multi.json",
- false,
- map[string]interface{}{
- "foo": []map[string]interface{}{
- map[string]interface{}{
- "baz": []map[string]interface{}{
- map[string]interface{}{"key": 7},
- },
- },
- map[string]interface{}{
- "bar": []map[string]interface{}{
- map[string]interface{}{"key": 12},
- },
- },
- },
- },
- },
- {
- "list_of_lists.hcl",
- false,
- map[string]interface{}{
- "foo": []interface{}{
- []interface{}{"foo"},
- []interface{}{"bar"},
- },
- },
- },
- {
- "list_of_maps.hcl",
- false,
- map[string]interface{}{
- "foo": []interface{}{
- map[string]interface{}{"somekey1": "someval1"},
- map[string]interface{}{"somekey2": "someval2", "someextrakey": "someextraval"},
- },
- },
- },
- {
- "assign_deep.hcl",
- false,
- map[string]interface{}{
- "resource": []interface{}{
- map[string]interface{}{
- "foo": []interface{}{
- map[string]interface{}{
- "bar": []map[string]interface{}{
- map[string]interface{}{}}}}}}},
- },
- {
- "structure_list.hcl",
- false,
- map[string]interface{}{
- "foo": []map[string]interface{}{
- map[string]interface{}{
- "key": 7,
- },
- map[string]interface{}{
- "key": 12,
- },
- },
- },
- },
- {
- "structure_list.json",
- false,
- map[string]interface{}{
- "foo": []map[string]interface{}{
- map[string]interface{}{
- "key": 7,
- },
- map[string]interface{}{
- "key": 12,
- },
- },
- },
- },
- {
- "structure_list_deep.json",
- false,
- map[string]interface{}{
- "bar": []map[string]interface{}{
- map[string]interface{}{
- "foo": []map[string]interface{}{
- map[string]interface{}{
- "name": "terraform_example",
- "ingress": []map[string]interface{}{
- map[string]interface{}{
- "from_port": 22,
- },
- map[string]interface{}{
- "from_port": 80,
- },
- },
- },
- },
- },
- },
- },
- },
-
- {
- "structure_list_empty.json",
- false,
- map[string]interface{}{
- "foo": []interface{}{},
- },
- },
-
- {
- "nested_block_comment.hcl",
- false,
- map[string]interface{}{
- "bar": "value",
- },
- },
-
- {
- "unterminated_block_comment.hcl",
- true,
- nil,
- },
-
- {
- "unterminated_brace.hcl",
- true,
- nil,
- },
-
- {
- "nested_provider_bad.hcl",
- true,
- nil,
- },
-
- {
- "object_list.json",
- false,
- map[string]interface{}{
- "resource": []map[string]interface{}{
- map[string]interface{}{
- "aws_instance": []map[string]interface{}{
- map[string]interface{}{
- "db": []map[string]interface{}{
- map[string]interface{}{
- "vpc": "foo",
- "provisioner": []map[string]interface{}{
- map[string]interface{}{
- "file": []map[string]interface{}{
- map[string]interface{}{
- "source": "foo",
- "destination": "bar",
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
-
- // Terraform GH-8295 sanity test that basic decoding into
- // interface{} works.
- {
- "terraform_variable_invalid.json",
- false,
- map[string]interface{}{
- "variable": []map[string]interface{}{
- map[string]interface{}{
- "whatever": "abc123",
- },
- },
- },
- },
-
- {
- "interpolate.json",
- false,
- map[string]interface{}{
- "default": `${replace("europe-west", "-", " ")}`,
- },
- },
-
- {
- "block_assign.hcl",
- true,
- nil,
- },
-
- {
- "escape_backslash.hcl",
- false,
- map[string]interface{}{
- "output": []map[string]interface{}{
- map[string]interface{}{
- "one": `${replace(var.sub_domain, ".", "\\.")}`,
- "two": `${replace(var.sub_domain, ".", "\\\\.")}`,
- "many": `${replace(var.sub_domain, ".", "\\\\\\\\.")}`,
- },
- },
- },
- },
-
- {
- "git_crypt.hcl",
- true,
- nil,
- },
-
- {
- "object_with_bool.hcl",
- false,
- map[string]interface{}{
- "path": []map[string]interface{}{
- map[string]interface{}{
- "policy": "write",
- "permissions": []map[string]interface{}{
- map[string]interface{}{
- "bool": []interface{}{false},
- },
- },
- },
- },
- },
- },
- }
-
- for _, tc := range cases {
- t.Run(tc.File, func(t *testing.T) {
- d, err := ioutil.ReadFile(filepath.Join(fixtureDir, tc.File))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- var out interface{}
- err = Decode(&out, string(d))
- if (err != nil) != tc.Err {
- t.Fatalf("Input: %s\n\nError: %s", tc.File, err)
- }
-
- if !reflect.DeepEqual(out, tc.Out) {
- t.Fatalf("Input: %s. Actual, Expected.\n\n%#v\n\n%#v", tc.File, out, tc.Out)
- }
-
- var v interface{}
- err = Unmarshal(d, &v)
- if (err != nil) != tc.Err {
- t.Fatalf("Input: %s\n\nError: %s", tc.File, err)
- }
-
- if !reflect.DeepEqual(v, tc.Out) {
- t.Fatalf("Input: %s. Actual, Expected.\n\n%#v\n\n%#v", tc.File, out, tc.Out)
- }
- })
- }
-}
-
-func TestDecode_interfaceInline(t *testing.T) {
- cases := []struct {
- Value string
- Err bool
- Out interface{}
- }{
- {"t t e{{}}", true, nil},
- {"t=0t d {}", true, map[string]interface{}{"t": 0}},
- {"v=0E0v d{}", true, map[string]interface{}{"v": float64(0)}},
- }
-
- for _, tc := range cases {
- t.Logf("Testing: %q", tc.Value)
-
- var out interface{}
- err := Decode(&out, tc.Value)
- if (err != nil) != tc.Err {
- t.Fatalf("Input: %q\n\nError: %s", tc.Value, err)
- }
-
- if !reflect.DeepEqual(out, tc.Out) {
- t.Fatalf("Input: %q. Actual, Expected.\n\n%#v\n\n%#v", tc.Value, out, tc.Out)
- }
-
- var v interface{}
- err = Unmarshal([]byte(tc.Value), &v)
- if (err != nil) != tc.Err {
- t.Fatalf("Input: %q\n\nError: %s", tc.Value, err)
- }
-
- if !reflect.DeepEqual(v, tc.Out) {
- t.Fatalf("Input: %q. Actual, Expected.\n\n%#v\n\n%#v", tc.Value, out, tc.Out)
- }
- }
-}
-
-func TestDecode_equal(t *testing.T) {
- cases := []struct {
- One, Two string
- }{
- {
- "basic.hcl",
- "basic.json",
- },
- {
- "float.hcl",
- "float.json",
- },
- /*
- {
- "structure.hcl",
- "structure.json",
- },
- */
- {
- "structure.hcl",
- "structure_flat.json",
- },
- {
- "terraform_heroku.hcl",
- "terraform_heroku.json",
- },
- }
-
- for _, tc := range cases {
- p1 := filepath.Join(fixtureDir, tc.One)
- p2 := filepath.Join(fixtureDir, tc.Two)
-
- d1, err := ioutil.ReadFile(p1)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- d2, err := ioutil.ReadFile(p2)
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- var i1, i2 interface{}
- err = Decode(&i1, string(d1))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- err = Decode(&i2, string(d2))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- if !reflect.DeepEqual(i1, i2) {
- t.Fatalf(
- "%s != %s\n\n%#v\n\n%#v",
- tc.One, tc.Two,
- i1, i2)
- }
- }
-}
-
-func TestDecode_flatMap(t *testing.T) {
- var val map[string]map[string]string
-
- err := Decode(&val, testReadFile(t, "structure_flatmap.hcl"))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- expected := map[string]map[string]string{
- "foo": map[string]string{
- "foo": "bar",
- "key": "7",
- },
- }
-
- if !reflect.DeepEqual(val, expected) {
- t.Fatalf("Actual: %#v\n\nExpected: %#v", val, expected)
- }
-}
-
-func TestDecode_structure(t *testing.T) {
- type Embedded interface{}
-
- type V struct {
- Embedded `hcl:"-"`
- Key int
- Foo string
- }
-
- var actual V
-
- err := Decode(&actual, testReadFile(t, "flat.hcl"))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- expected := V{
- Key: 7,
- Foo: "bar",
- }
-
- if !reflect.DeepEqual(actual, expected) {
- t.Fatalf("Actual: %#v\n\nExpected: %#v", actual, expected)
- }
-}
-
-func TestDecode_structurePtr(t *testing.T) {
- type V struct {
- Key int
- Foo string
- }
-
- var actual *V
-
- err := Decode(&actual, testReadFile(t, "flat.hcl"))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- expected := &V{
- Key: 7,
- Foo: "bar",
- }
-
- if !reflect.DeepEqual(actual, expected) {
- t.Fatalf("Actual: %#v\n\nExpected: %#v", actual, expected)
- }
-}
-
-func TestDecode_structureArray(t *testing.T) {
- // This test is extracted from a failure in Consul (consul.io),
- // hence the interesting structure naming.
-
- type KeyPolicyType string
-
- type KeyPolicy struct {
- Prefix string `hcl:",key"`
- Policy KeyPolicyType
- }
-
- type Policy struct {
- Keys []KeyPolicy `hcl:"key,expand"`
- }
-
- expected := Policy{
- Keys: []KeyPolicy{
- KeyPolicy{
- Prefix: "",
- Policy: "read",
- },
- KeyPolicy{
- Prefix: "foo/",
- Policy: "write",
- },
- KeyPolicy{
- Prefix: "foo/bar/",
- Policy: "read",
- },
- KeyPolicy{
- Prefix: "foo/bar/baz",
- Policy: "deny",
- },
- },
- }
-
- files := []string{
- "decode_policy.hcl",
- "decode_policy.json",
- }
-
- for _, f := range files {
- var actual Policy
-
- err := Decode(&actual, testReadFile(t, f))
- if err != nil {
- t.Fatalf("Input: %s\n\nerr: %s", f, err)
- }
-
- if !reflect.DeepEqual(actual, expected) {
- t.Fatalf("Input: %s\n\nActual: %#v\n\nExpected: %#v", f, actual, expected)
- }
- }
-}
-
-func TestDecode_sliceExpand(t *testing.T) {
- type testInner struct {
- Name string `hcl:",key"`
- Key string
- }
-
- type testStruct struct {
- Services []testInner `hcl:"service,expand"`
- }
-
- expected := testStruct{
- Services: []testInner{
- testInner{
- Name: "my-service-0",
- Key: "value",
- },
- testInner{
- Name: "my-service-1",
- Key: "value",
- },
- },
- }
-
- files := []string{
- "slice_expand.hcl",
- }
-
- for _, f := range files {
- t.Logf("Testing: %s", f)
-
- var actual testStruct
- err := Decode(&actual, testReadFile(t, f))
- if err != nil {
- t.Fatalf("Input: %s\n\nerr: %s", f, err)
- }
-
- if !reflect.DeepEqual(actual, expected) {
- t.Fatalf("Input: %s\n\nActual: %#v\n\nExpected: %#v", f, actual, expected)
- }
- }
-}
-
-func TestDecode_structureMap(t *testing.T) {
- // This test is extracted from a failure in Terraform (terraform.io),
- // hence the interesting structure naming.
-
- type hclVariable struct {
- Default interface{}
- Description string
- Fields []string `hcl:",decodedFields"`
- }
-
- type rawConfig struct {
- Variable map[string]hclVariable
- }
-
- expected := rawConfig{
- Variable: map[string]hclVariable{
- "foo": hclVariable{
- Default: "bar",
- Description: "bar",
- Fields: []string{"Default", "Description"},
- },
-
- "amis": hclVariable{
- Default: []map[string]interface{}{
- map[string]interface{}{
- "east": "foo",
- },
- },
- Fields: []string{"Default"},
- },
- },
- }
-
- files := []string{
- "decode_tf_variable.hcl",
- "decode_tf_variable.json",
- }
-
- for _, f := range files {
- t.Logf("Testing: %s", f)
-
- var actual rawConfig
- err := Decode(&actual, testReadFile(t, f))
- if err != nil {
- t.Fatalf("Input: %s\n\nerr: %s", f, err)
- }
-
- if !reflect.DeepEqual(actual, expected) {
- t.Fatalf("Input: %s\n\nActual: %#v\n\nExpected: %#v", f, actual, expected)
- }
- }
-}
-
-func TestDecode_structureMapInvalid(t *testing.T) {
- // Terraform GH-8295
-
- type hclVariable struct {
- Default interface{}
- Description string
- Fields []string `hcl:",decodedFields"`
- }
-
- type rawConfig struct {
- Variable map[string]*hclVariable
- }
-
- var actual rawConfig
- err := Decode(&actual, testReadFile(t, "terraform_variable_invalid.json"))
- if err == nil {
- t.Fatal("expected error")
- }
-}
-
-func TestDecode_interfaceNonPointer(t *testing.T) {
- var value interface{}
- err := Decode(value, testReadFile(t, "basic_int_string.hcl"))
- if err == nil {
- t.Fatal("should error")
- }
-}
-
-func TestDecode_intString(t *testing.T) {
- var value struct {
- Count int
- }
-
- err := Decode(&value, testReadFile(t, "basic_int_string.hcl"))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- if value.Count != 3 {
- t.Fatalf("bad: %#v", value.Count)
- }
-}
-
-func TestDecode_float32(t *testing.T) {
- var value struct {
- A float32 `hcl:"a"`
- B float32 `hcl:"b"`
- }
-
- err := Decode(&value, testReadFile(t, "float.hcl"))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- if got, want := value.A, float32(1.02); got != want {
- t.Fatalf("wrong result %#v; want %#v", got, want)
- }
- if got, want := value.B, float32(2); got != want {
- t.Fatalf("wrong result %#v; want %#v", got, want)
- }
-}
-
-func TestDecode_float64(t *testing.T) {
- var value struct {
- A float64 `hcl:"a"`
- B float64 `hcl:"b"`
- }
-
- err := Decode(&value, testReadFile(t, "float.hcl"))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- if got, want := value.A, float64(1.02); got != want {
- t.Fatalf("wrong result %#v; want %#v", got, want)
- }
- if got, want := value.B, float64(2); got != want {
- t.Fatalf("wrong result %#v; want %#v", got, want)
- }
-}
-
-func TestDecode_intStringAliased(t *testing.T) {
- var value struct {
- Count time.Duration
- }
-
- err := Decode(&value, testReadFile(t, "basic_int_string.hcl"))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- if value.Count != time.Duration(3) {
- t.Fatalf("bad: %#v", value.Count)
- }
-}
-
-func TestDecode_Node(t *testing.T) {
- // given
- var value struct {
- Content ast.Node
- Nested struct {
- Content ast.Node
- }
- }
-
- content := `
-content {
- hello = "world"
-}
-`
-
- // when
- err := Decode(&value, content)
-
- // then
- if err != nil {
- t.Errorf("unable to decode content, %v", err)
- return
- }
-
- // verify ast.Node can be decoded later
- var v map[string]interface{}
- err = DecodeObject(&v, value.Content)
- if err != nil {
- t.Errorf("unable to decode content, %v", err)
- return
- }
-
- if v["hello"] != "world" {
- t.Errorf("expected mapping to be returned")
- }
-}
-
-func TestDecode_NestedNode(t *testing.T) {
- // given
- var value struct {
- Nested struct {
- Content ast.Node
- }
- }
-
- content := `
-nested "content" {
- hello = "world"
-}
-`
-
- // when
- err := Decode(&value, content)
-
- // then
- if err != nil {
- t.Errorf("unable to decode content, %v", err)
- return
- }
-
- // verify ast.Node can be decoded later
- var v map[string]interface{}
- err = DecodeObject(&v, value.Nested.Content)
- if err != nil {
- t.Errorf("unable to decode content, %v", err)
- return
- }
-
- if v["hello"] != "world" {
- t.Errorf("expected mapping to be returned")
- }
-}
-
-// https://github.com/hashicorp/hcl/issues/60
-func TestDecode_topLevelKeys(t *testing.T) {
- type Template struct {
- Source string
- }
-
- templates := struct {
- Templates []*Template `hcl:"template"`
- }{}
-
- err := Decode(&templates, `
- template {
- source = "blah"
- }
-
- template {
- source = "blahblah"
- }`)
-
- if err != nil {
- t.Fatal(err)
- }
-
- if templates.Templates[0].Source != "blah" {
- t.Errorf("bad source: %s", templates.Templates[0].Source)
- }
-
- if templates.Templates[1].Source != "blahblah" {
- t.Errorf("bad source: %s", templates.Templates[1].Source)
- }
-}
-
-func TestDecode_flattenedJSON(t *testing.T) {
- // make sure we can also correctly extract a Name key too
- type V struct {
- Name string `hcl:",key"`
- Description string
- Default map[string]string
- }
- type Vars struct {
- Variable []*V
- }
-
- cases := []struct {
- JSON string
- Out interface{}
- Expected interface{}
- }{
- { // Nested object, no sibling keys
- JSON: `
-{
- "var_name": {
- "default": {
- "key1": "a",
- "key2": "b"
- }
- }
-}
- `,
- Out: &[]*V{},
- Expected: &[]*V{
- &V{
- Name: "var_name",
- Default: map[string]string{"key1": "a", "key2": "b"},
- },
- },
- },
-
- { // Nested object with a sibling key (this worked previously)
- JSON: `
-{
- "var_name": {
- "description": "Described",
- "default": {
- "key1": "a",
- "key2": "b"
- }
- }
-}
- `,
- Out: &[]*V{},
- Expected: &[]*V{
- &V{
- Name: "var_name",
- Description: "Described",
- Default: map[string]string{"key1": "a", "key2": "b"},
- },
- },
- },
-
- { // Multiple nested objects, one with a sibling key
- JSON: `
-{
- "variable": {
- "var_1": {
- "default": {
- "key1": "a",
- "key2": "b"
- }
- },
- "var_2": {
- "description": "Described",
- "default": {
- "key1": "a",
- "key2": "b"
- }
- }
- }
-}
- `,
- Out: &Vars{},
- Expected: &Vars{
- Variable: []*V{
- &V{
- Name: "var_1",
- Default: map[string]string{"key1": "a", "key2": "b"},
- },
- &V{
- Name: "var_2",
- Description: "Described",
- Default: map[string]string{"key1": "a", "key2": "b"},
- },
- },
- },
- },
-
- { // Nested object to maps
- JSON: `
-{
- "variable": {
- "var_name": {
- "description": "Described",
- "default": {
- "key1": "a",
- "key2": "b"
- }
- }
- }
-}
- `,
- Out: &[]map[string]interface{}{},
- Expected: &[]map[string]interface{}{
- {
- "variable": []map[string]interface{}{
- {
- "var_name": []map[string]interface{}{
- {
- "description": "Described",
- "default": []map[string]interface{}{
- {
- "key1": "a",
- "key2": "b",
- },
- },
- },
- },
- },
- },
- },
- },
- },
-
- { // Nested object to maps without a sibling key should decode the same as above
- JSON: `
-{
- "variable": {
- "var_name": {
- "default": {
- "key1": "a",
- "key2": "b"
- }
- }
- }
-}
- `,
- Out: &[]map[string]interface{}{},
- Expected: &[]map[string]interface{}{
- {
- "variable": []map[string]interface{}{
- {
- "var_name": []map[string]interface{}{
- {
- "default": []map[string]interface{}{
- {
- "key1": "a",
- "key2": "b",
- },
- },
- },
- },
- },
- },
- },
- },
- },
-
- { // Nested objects, one with a sibling key, and one without
- JSON: `
-{
- "variable": {
- "var_1": {
- "default": {
- "key1": "a",
- "key2": "b"
- }
- },
- "var_2": {
- "description": "Described",
- "default": {
- "key1": "a",
- "key2": "b"
- }
- }
- }
-}
- `,
- Out: &[]map[string]interface{}{},
- Expected: &[]map[string]interface{}{
- {
- "variable": []map[string]interface{}{
- {
- "var_1": []map[string]interface{}{
- {
- "default": []map[string]interface{}{
- {
- "key1": "a",
- "key2": "b",
- },
- },
- },
- },
- },
- },
- },
- {
- "variable": []map[string]interface{}{
- {
- "var_2": []map[string]interface{}{
- {
- "description": "Described",
- "default": []map[string]interface{}{
- {
- "key1": "a",
- "key2": "b",
- },
- },
- },
- },
- },
- },
- },
- },
- },
- }
-
- for i, tc := range cases {
- err := Decode(tc.Out, tc.JSON)
- if err != nil {
- t.Fatalf("[%d] err: %s", i, err)
- }
-
- if !reflect.DeepEqual(tc.Out, tc.Expected) {
- t.Fatalf("[%d]\ngot: %s\nexpected: %s\n", i, spew.Sdump(tc.Out), spew.Sdump(tc.Expected))
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/ast/ast_test.go b/vendor/github.com/hashicorp/hcl/hcl/ast/ast_test.go
deleted file mode 100644
index 942256cad..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/ast/ast_test.go
+++ /dev/null
@@ -1,200 +0,0 @@
-package ast
-
-import (
- "reflect"
- "strings"
- "testing"
-
- "github.com/hashicorp/hcl/hcl/token"
-)
-
-func TestObjectListFilter(t *testing.T) {
- var cases = []struct {
- Filter []string
- Input []*ObjectItem
- Output []*ObjectItem
- }{
- {
- []string{"foo"},
- []*ObjectItem{
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{
- Token: token.Token{Type: token.STRING, Text: `"foo"`},
- },
- },
- },
- },
- []*ObjectItem{
- &ObjectItem{
- Keys: []*ObjectKey{},
- },
- },
- },
-
- {
- []string{"foo"},
- []*ObjectItem{
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}},
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}},
- },
- },
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"baz"`}},
- },
- },
- },
- []*ObjectItem{
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}},
- },
- },
- },
- },
- }
-
- for _, tc := range cases {
- input := &ObjectList{Items: tc.Input}
- expected := &ObjectList{Items: tc.Output}
- if actual := input.Filter(tc.Filter...); !reflect.DeepEqual(actual, expected) {
- t.Fatalf("in order: input, expected, actual\n\n%#v\n\n%#v\n\n%#v", input, expected, actual)
- }
- }
-}
-
-func TestWalk(t *testing.T) {
- items := []*ObjectItem{
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}},
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}},
- },
- Val: &LiteralType{Token: token.Token{Type: token.STRING, Text: `"example"`}},
- },
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"baz"`}},
- },
- },
- }
-
- node := &ObjectList{Items: items}
-
- order := []string{
- "*ast.ObjectList",
- "*ast.ObjectItem",
- "*ast.ObjectKey",
- "*ast.ObjectKey",
- "*ast.LiteralType",
- "*ast.ObjectItem",
- "*ast.ObjectKey",
- }
- count := 0
-
- Walk(node, func(n Node) (Node, bool) {
- if n == nil {
- return n, false
- }
-
- typeName := reflect.TypeOf(n).String()
- if order[count] != typeName {
- t.Errorf("expected '%s' got: '%s'", order[count], typeName)
- }
- count++
- return n, true
- })
-}
-
-func TestWalkEquality(t *testing.T) {
- items := []*ObjectItem{
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}},
- },
- },
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}},
- },
- },
- }
-
- node := &ObjectList{Items: items}
-
- rewritten := Walk(node, func(n Node) (Node, bool) { return n, true })
-
- newNode, ok := rewritten.(*ObjectList)
- if !ok {
- t.Fatalf("expected Objectlist, got %T", rewritten)
- }
-
- if !reflect.DeepEqual(node, newNode) {
- t.Fatal("rewritten node is not equal to the given node")
- }
-
- if len(newNode.Items) != 2 {
- t.Error("expected newNode length 2, got: %d", len(newNode.Items))
- }
-
- expected := []string{
- `"foo"`,
- `"bar"`,
- }
-
- for i, item := range newNode.Items {
- if len(item.Keys) != 1 {
- t.Error("expected keys newNode length 1, got: %d", len(item.Keys))
- }
-
- if item.Keys[0].Token.Text != expected[i] {
- t.Errorf("expected key %s, got %s", expected[i], item.Keys[0].Token.Text)
- }
-
- if item.Val != nil {
- t.Errorf("expected item value should be nil")
- }
- }
-}
-
-func TestWalkRewrite(t *testing.T) {
- items := []*ObjectItem{
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}},
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}},
- },
- },
- &ObjectItem{
- Keys: []*ObjectKey{
- &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"baz"`}},
- },
- },
- }
-
- node := &ObjectList{Items: items}
-
- suffix := "_example"
- node = Walk(node, func(n Node) (Node, bool) {
- switch i := n.(type) {
- case *ObjectKey:
- i.Token.Text = i.Token.Text + suffix
- n = i
- }
- return n, true
- }).(*ObjectList)
-
- Walk(node, func(n Node) (Node, bool) {
- switch i := n.(type) {
- case *ObjectKey:
- if !strings.HasSuffix(i.Token.Text, suffix) {
- t.Errorf("Token '%s' should have suffix: %s", i.Token.Text, suffix)
- }
- }
- return n, true
- })
-
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go b/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go
deleted file mode 100644
index 2380d71e3..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd.go
+++ /dev/null
@@ -1,162 +0,0 @@
-// Derivative work from:
-// - https://golang.org/src/cmd/gofmt/gofmt.go
-// - https://github.com/fatih/hclfmt
-
-package fmtcmd
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "os"
- "os/exec"
- "path/filepath"
- "strings"
-
- "github.com/hashicorp/hcl/hcl/printer"
-)
-
-var (
- ErrWriteStdin = errors.New("cannot use write option with standard input")
-)
-
-type Options struct {
- List bool // list files whose formatting differs
- Write bool // write result to (source) file instead of stdout
- Diff bool // display diffs of formatting changes
-}
-
-func isValidFile(f os.FileInfo, extensions []string) bool {
- if !f.IsDir() && !strings.HasPrefix(f.Name(), ".") {
- for _, ext := range extensions {
- if strings.HasSuffix(f.Name(), "."+ext) {
- return true
- }
- }
- }
-
- return false
-}
-
-// If in == nil, the source is the contents of the file with the given filename.
-func processFile(filename string, in io.Reader, out io.Writer, stdin bool, opts Options) error {
- if in == nil {
- f, err := os.Open(filename)
- if err != nil {
- return err
- }
- defer f.Close()
- in = f
- }
-
- src, err := ioutil.ReadAll(in)
- if err != nil {
- return err
- }
-
- res, err := printer.Format(src)
- if err != nil {
- return fmt.Errorf("In %s: %s", filename, err)
- }
-
- if !bytes.Equal(src, res) {
- // formatting has changed
- if opts.List {
- fmt.Fprintln(out, filename)
- }
- if opts.Write {
- err = ioutil.WriteFile(filename, res, 0644)
- if err != nil {
- return err
- }
- }
- if opts.Diff {
- data, err := diff(src, res)
- if err != nil {
- return fmt.Errorf("computing diff: %s", err)
- }
- fmt.Fprintf(out, "diff a/%s b/%s\n", filename, filename)
- out.Write(data)
- }
- }
-
- if !opts.List && !opts.Write && !opts.Diff {
- _, err = out.Write(res)
- }
-
- return err
-}
-
-func walkDir(path string, extensions []string, stdout io.Writer, opts Options) error {
- visitFile := func(path string, f os.FileInfo, err error) error {
- if err == nil && isValidFile(f, extensions) {
- err = processFile(path, nil, stdout, false, opts)
- }
- return err
- }
-
- return filepath.Walk(path, visitFile)
-}
-
-func Run(
- paths, extensions []string,
- stdin io.Reader,
- stdout io.Writer,
- opts Options,
-) error {
- if len(paths) == 0 {
- if opts.Write {
- return ErrWriteStdin
- }
- if err := processFile("<standard input>", stdin, stdout, true, opts); err != nil {
- return err
- }
- return nil
- }
-
- for _, path := range paths {
- switch dir, err := os.Stat(path); {
- case err != nil:
- return err
- case dir.IsDir():
- if err := walkDir(path, extensions, stdout, opts); err != nil {
- return err
- }
- default:
- if err := processFile(path, nil, stdout, false, opts); err != nil {
- return err
- }
- }
- }
-
- return nil
-}
-
-func diff(b1, b2 []byte) (data []byte, err error) {
- f1, err := ioutil.TempFile("", "")
- if err != nil {
- return
- }
- defer os.Remove(f1.Name())
- defer f1.Close()
-
- f2, err := ioutil.TempFile("", "")
- if err != nil {
- return
- }
- defer os.Remove(f2.Name())
- defer f2.Close()
-
- f1.Write(b1)
- f2.Write(b2)
-
- data, err = exec.Command("diff", "-u", f1.Name(), f2.Name()).CombinedOutput()
- if len(data) > 0 {
- // diff exits with a non-zero status when the files don't match.
- // Ignore that failure as long as we get output.
- err = nil
- }
- return
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd_test.go b/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd_test.go
deleted file mode 100644
index b952d76d8..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/fmtcmd_test.go
+++ /dev/null
@@ -1,440 +0,0 @@
-// +build !windows
-// TODO(jen20): These need fixing on Windows but fmt is not used right now
-// and red CI is making it harder to process other bugs, so ignore until
-// we get around to fixing them.
-
-package fmtcmd
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "os"
- "path/filepath"
- "reflect"
- "regexp"
- "sort"
- "syscall"
- "testing"
-
- "github.com/hashicorp/hcl/testhelper"
-)
-
-var fixtureExtensions = []string{"hcl"}
-
-func init() {
- sort.Sort(ByFilename(fixtures))
-}
-
-func TestIsValidFile(t *testing.T) {
- const fixtureDir = "./test-fixtures"
-
- cases := []struct {
- Path string
- Expected bool
- }{
- {"good.hcl", true},
- {".hidden.ignore", false},
- {"file.ignore", false},
- {"dir.ignore", false},
- }
-
- for _, tc := range cases {
- file, err := os.Stat(filepath.Join(fixtureDir, tc.Path))
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
-
- if res := isValidFile(file, fixtureExtensions); res != tc.Expected {
- t.Errorf("want: %b, got: %b", tc.Expected, res)
- }
- }
-}
-
-func TestRunMultiplePaths(t *testing.T) {
- path1, err := renderFixtures("")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(path1)
- path2, err := renderFixtures("")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(path2)
-
- var expectedOut bytes.Buffer
- for _, path := range []string{path1, path2} {
- for _, fixture := range fixtures {
- if !bytes.Equal(fixture.golden, fixture.input) {
- expectedOut.WriteString(filepath.Join(path, fixture.filename) + "\n")
- }
- }
- }
-
- _, stdout := mockIO()
- err = Run(
- []string{path1, path2},
- fixtureExtensions,
- nil, stdout,
- Options{
- List: true,
- },
- )
-
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- if stdout.String() != expectedOut.String() {
- t.Errorf("stdout want:\n%s\ngot:\n%s", expectedOut, stdout)
- }
-}
-
-func TestRunSubDirectories(t *testing.T) {
- pathParent, err := ioutil.TempDir("", "")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(pathParent)
-
- path1, err := renderFixtures(pathParent)
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- path2, err := renderFixtures(pathParent)
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
-
- paths := []string{path1, path2}
- sort.Strings(paths)
-
- var expectedOut bytes.Buffer
- for _, path := range paths {
- for _, fixture := range fixtures {
- if !bytes.Equal(fixture.golden, fixture.input) {
- expectedOut.WriteString(filepath.Join(path, fixture.filename) + "\n")
- }
- }
- }
-
- _, stdout := mockIO()
- err = Run(
- []string{pathParent},
- fixtureExtensions,
- nil, stdout,
- Options{
- List: true,
- },
- )
-
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- if stdout.String() != expectedOut.String() {
- t.Errorf("stdout want:\n%s\ngot:\n%s", expectedOut, stdout)
- }
-}
-
-func TestRunStdin(t *testing.T) {
- var expectedOut bytes.Buffer
- for i, fixture := range fixtures {
- if i != 0 {
- expectedOut.WriteString("\n")
- }
- expectedOut.Write(fixture.golden)
- }
-
- stdin, stdout := mockIO()
- for _, fixture := range fixtures {
- stdin.Write(fixture.input)
- }
-
- err := Run(
- []string{},
- fixtureExtensions,
- stdin, stdout,
- Options{},
- )
-
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- if !bytes.Equal(stdout.Bytes(), expectedOut.Bytes()) {
- t.Errorf("stdout want:\n%s\ngot:\n%s", expectedOut, stdout)
- }
-}
-
-func TestRunStdinAndWrite(t *testing.T) {
- var expectedOut = []byte{}
-
- stdin, stdout := mockIO()
- stdin.WriteString("")
- err := Run(
- []string{}, []string{},
- stdin, stdout,
- Options{
- Write: true,
- },
- )
-
- if err != ErrWriteStdin {
- t.Errorf("error want:\n%s\ngot:\n%s", ErrWriteStdin, err)
- }
- if !bytes.Equal(stdout.Bytes(), expectedOut) {
- t.Errorf("stdout want:\n%s\ngot:\n%s", expectedOut, stdout)
- }
-}
-
-func TestRunFileError(t *testing.T) {
- path, err := ioutil.TempDir("", "")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(path)
- filename := filepath.Join(path, "unreadable.hcl")
-
- var expectedError = &os.PathError{
- Op: "open",
- Path: filename,
- Err: syscall.EACCES,
- }
-
- err = ioutil.WriteFile(filename, []byte{}, 0000)
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
-
- _, stdout := mockIO()
- err = Run(
- []string{path},
- fixtureExtensions,
- nil, stdout,
- Options{},
- )
-
- if !reflect.DeepEqual(err, expectedError) {
- t.Errorf("error want: %#v, got: %#v", expectedError, err)
- }
-}
-
-func TestRunNoOptions(t *testing.T) {
- path, err := renderFixtures("")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(path)
-
- var expectedOut bytes.Buffer
- for _, fixture := range fixtures {
- expectedOut.Write(fixture.golden)
- }
-
- _, stdout := mockIO()
- err = Run(
- []string{path},
- fixtureExtensions,
- nil, stdout,
- Options{},
- )
-
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- if stdout.String() != expectedOut.String() {
- t.Errorf("stdout want:\n%s\ngot:\n%s", expectedOut, stdout)
- }
-}
-
-func TestRunList(t *testing.T) {
- path, err := renderFixtures("")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(path)
-
- var expectedOut bytes.Buffer
- for _, fixture := range fixtures {
- if !bytes.Equal(fixture.golden, fixture.input) {
- expectedOut.WriteString(fmt.Sprintln(filepath.Join(path, fixture.filename)))
- }
- }
-
- _, stdout := mockIO()
- err = Run(
- []string{path},
- fixtureExtensions,
- nil, stdout,
- Options{
- List: true,
- },
- )
-
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- if stdout.String() != expectedOut.String() {
- t.Errorf("stdout want:\n%s\ngot:\n%s", expectedOut, stdout)
- }
-}
-
-func TestRunWrite(t *testing.T) {
- path, err := renderFixtures("")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(path)
-
- _, stdout := mockIO()
- err = Run(
- []string{path},
- fixtureExtensions,
- nil, stdout,
- Options{
- Write: true,
- },
- )
-
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- for _, fixture := range fixtures {
- res, err := ioutil.ReadFile(filepath.Join(path, fixture.filename))
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- if !bytes.Equal(res, fixture.golden) {
- t.Errorf("file %q contents want:\n%s\ngot:\n%s", fixture.filename, fixture.golden, res)
- }
- }
-}
-
-func TestRunDiff(t *testing.T) {
- path, err := renderFixtures("")
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- defer os.RemoveAll(path)
-
- var expectedOut bytes.Buffer
- for _, fixture := range fixtures {
- if len(fixture.diff) > 0 {
- expectedOut.WriteString(
- regexp.QuoteMeta(
- fmt.Sprintf("diff a/%s/%s b/%s/%s\n", path, fixture.filename, path, fixture.filename),
- ),
- )
- // Need to use regex to ignore datetimes in diff.
- expectedOut.WriteString(`--- .+?\n`)
- expectedOut.WriteString(`\+\+\+ .+?\n`)
- expectedOut.WriteString(regexp.QuoteMeta(string(fixture.diff)))
- }
- }
-
- expectedOutString := testhelper.Unix2dos(expectedOut.String())
-
- _, stdout := mockIO()
- err = Run(
- []string{path},
- fixtureExtensions,
- nil, stdout,
- Options{
- Diff: true,
- },
- )
-
- if err != nil {
- t.Errorf("unexpected error: %s", err)
- }
- if !regexp.MustCompile(expectedOutString).Match(stdout.Bytes()) {
- t.Errorf("stdout want match:\n%s\ngot:\n%q", expectedOutString, stdout)
- }
-}
-
-func mockIO() (stdin, stdout *bytes.Buffer) {
- return new(bytes.Buffer), new(bytes.Buffer)
-}
-
-type fixture struct {
- filename string
- input, golden, diff []byte
-}
-
-type ByFilename []fixture
-
-func (s ByFilename) Len() int { return len(s) }
-func (s ByFilename) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-func (s ByFilename) Less(i, j int) bool { return len(s[i].filename) > len(s[j].filename) }
-
-var fixtures = []fixture{
- {
- "noop.hcl",
- []byte(`resource "aws_security_group" "firewall" {
- count = 5
-}
-`),
- []byte(`resource "aws_security_group" "firewall" {
- count = 5
-}
-`),
- []byte(``),
- }, {
- "align_equals.hcl",
- []byte(`variable "foo" {
- default = "bar"
- description = "bar"
-}
-`),
- []byte(`variable "foo" {
- default = "bar"
- description = "bar"
-}
-`),
- []byte(`@@ -1,4 +1,4 @@
- variable "foo" {
-- default = "bar"
-+ default = "bar"
- description = "bar"
- }
-`),
- }, {
- "indentation.hcl",
- []byte(`provider "aws" {
- access_key = "foo"
- secret_key = "bar"
-}
-`),
- []byte(`provider "aws" {
- access_key = "foo"
- secret_key = "bar"
-}
-`),
- []byte(`@@ -1,4 +1,4 @@
- provider "aws" {
-- access_key = "foo"
-- secret_key = "bar"
-+ access_key = "foo"
-+ secret_key = "bar"
- }
-`),
- },
-}
-
-// parent can be an empty string, in which case the system's default
-// temporary directory will be used.
-func renderFixtures(parent string) (path string, err error) {
- path, err = ioutil.TempDir(parent, "")
- if err != nil {
- return "", err
- }
-
- for _, fixture := range fixtures {
- err = ioutil.WriteFile(filepath.Join(path, fixture.filename), []byte(fixture.input), 0644)
- if err != nil {
- os.RemoveAll(path)
- return "", err
- }
- }
-
- return path, nil
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/.hidden.ignore b/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/.hidden.ignore
deleted file mode 100644
index 9977a2836..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/.hidden.ignore
+++ /dev/null
@@ -1 +0,0 @@
-invalid
diff --git a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/dir.ignore b/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/dir.ignore
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/dir.ignore
+++ /dev/null
diff --git a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/file.ignore b/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/file.ignore
deleted file mode 100644
index 9977a2836..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/file.ignore
+++ /dev/null
@@ -1 +0,0 @@
-invalid
diff --git a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/good.hcl b/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/good.hcl
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/fmtcmd/test-fixtures/good.hcl
+++ /dev/null
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/error_test.go b/vendor/github.com/hashicorp/hcl/hcl/parser/error_test.go
deleted file mode 100644
index 32399fec5..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/error_test.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package parser
-
-import (
- "testing"
-)
-
-func TestPosError_impl(t *testing.T) {
- var _ error = new(PosError)
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go b/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go
index 098e1bc49..64c83bcfb 100644
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go
+++ b/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go
@@ -205,6 +205,12 @@ func (p *Parser) objectItem() (*ast.ObjectItem, error) {
}
}
+ // key=#comment
+ // val
+ if p.lineComment != nil {
+ o.LineComment, p.lineComment = p.lineComment, nil
+ }
+
// do a look-ahead for line comment
p.scan()
if len(keys) > 0 && o.Val.Pos().Line == keys[0].Pos().Line && p.lineComment != nil {
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/parser_test.go b/vendor/github.com/hashicorp/hcl/hcl/parser/parser_test.go
deleted file mode 100644
index 270212207..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/parser_test.go
+++ /dev/null
@@ -1,575 +0,0 @@
-package parser
-
-import (
- "fmt"
- "io/ioutil"
- "path/filepath"
- "reflect"
- "runtime"
- "strings"
- "testing"
-
- "github.com/hashicorp/hcl/hcl/ast"
- "github.com/hashicorp/hcl/hcl/token"
-)
-
-func TestType(t *testing.T) {
- var literals = []struct {
- typ token.Type
- src string
- }{
- {token.STRING, `foo = "foo"`},
- {token.NUMBER, `foo = 123`},
- {token.NUMBER, `foo = -29`},
- {token.FLOAT, `foo = 123.12`},
- {token.FLOAT, `foo = -123.12`},
- {token.BOOL, `foo = true`},
- {token.HEREDOC, "foo = <<EOF\nHello\nWorld\nEOF"},
- }
-
- for _, l := range literals {
- p := newParser([]byte(l.src))
- item, err := p.objectItem()
- if err != nil {
- t.Error(err)
- }
-
- lit, ok := item.Val.(*ast.LiteralType)
- if !ok {
- t.Errorf("node should be of type LiteralType, got: %T", item.Val)
- }
-
- if lit.Token.Type != l.typ {
- t.Errorf("want: %s, got: %s", l.typ, lit.Token.Type)
- }
- }
-}
-
-func TestListType(t *testing.T) {
- var literals = []struct {
- src string
- tokens []token.Type
- }{
- {
- `foo = ["123", 123]`,
- []token.Type{token.STRING, token.NUMBER},
- },
- {
- `foo = [123, "123",]`,
- []token.Type{token.NUMBER, token.STRING},
- },
- {
- `foo = [false]`,
- []token.Type{token.BOOL},
- },
- {
- `foo = []`,
- []token.Type{},
- },
- {
- `foo = [1,
-"string",
-<<EOF
-heredoc contents
-EOF
-]`,
- []token.Type{token.NUMBER, token.STRING, token.HEREDOC},
- },
- }
-
- for _, l := range literals {
- p := newParser([]byte(l.src))
- item, err := p.objectItem()
- if err != nil {
- t.Error(err)
- }
-
- list, ok := item.Val.(*ast.ListType)
- if !ok {
- t.Errorf("node should be of type LiteralType, got: %T", item.Val)
- }
-
- tokens := []token.Type{}
- for _, li := range list.List {
- if tp, ok := li.(*ast.LiteralType); ok {
- tokens = append(tokens, tp.Token.Type)
- }
- }
-
- equals(t, l.tokens, tokens)
- }
-}
-
-func TestListOfMaps(t *testing.T) {
- src := `foo = [
- {key = "bar"},
- {key = "baz", key2 = "qux"},
- ]`
- p := newParser([]byte(src))
-
- file, err := p.Parse()
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- // Here we make all sorts of assumptions about the input structure w/ type
- // assertions. The intent is only for this to be a "smoke test" ensuring
- // parsing actually performed its duty - giving this test something a bit
- // more robust than _just_ "no error occurred".
- expected := []string{`"bar"`, `"baz"`, `"qux"`}
- actual := make([]string, 0, 3)
- ol := file.Node.(*ast.ObjectList)
- objItem := ol.Items[0]
- list := objItem.Val.(*ast.ListType)
- for _, node := range list.List {
- obj := node.(*ast.ObjectType)
- for _, item := range obj.List.Items {
- val := item.Val.(*ast.LiteralType)
- actual = append(actual, val.Token.Text)
- }
-
- }
- if !reflect.DeepEqual(expected, actual) {
- t.Fatalf("Expected: %#v, got %#v", expected, actual)
- }
-}
-
-func TestListOfMaps_requiresComma(t *testing.T) {
- src := `foo = [
- {key = "bar"}
- {key = "baz"}
- ]`
- p := newParser([]byte(src))
-
- _, err := p.Parse()
- if err == nil {
- t.Fatalf("Expected error, got none!")
- }
-
- expected := "error parsing list, expected comma or list end"
- if !strings.Contains(err.Error(), expected) {
- t.Fatalf("Expected err:\n %s\nTo contain:\n %s\n", err, expected)
- }
-}
-
-func TestListType_leadComment(t *testing.T) {
- var literals = []struct {
- src string
- comment []string
- }{
- {
- `foo = [
- 1,
- # bar
- 2,
- 3,
- ]`,
- []string{"", "# bar", ""},
- },
- }
-
- for _, l := range literals {
- p := newParser([]byte(l.src))
- item, err := p.objectItem()
- if err != nil {
- t.Fatal(err)
- }
-
- list, ok := item.Val.(*ast.ListType)
- if !ok {
- t.Fatalf("node should be of type LiteralType, got: %T", item.Val)
- }
-
- if len(list.List) != len(l.comment) {
- t.Fatalf("bad: %d", len(list.List))
- }
-
- for i, li := range list.List {
- lt := li.(*ast.LiteralType)
- comment := l.comment[i]
-
- if (lt.LeadComment == nil) != (comment == "") {
- t.Fatalf("bad: %#v", lt)
- }
-
- if comment == "" {
- continue
- }
-
- actual := lt.LeadComment.List[0].Text
- if actual != comment {
- t.Fatalf("bad: %q %q", actual, comment)
- }
- }
- }
-}
-
-func TestListType_lineComment(t *testing.T) {
- var literals = []struct {
- src string
- comment []string
- }{
- {
- `foo = [
- 1,
- 2, # bar
- 3,
- ]`,
- []string{"", "# bar", ""},
- },
- }
-
- for _, l := range literals {
- p := newParser([]byte(l.src))
- item, err := p.objectItem()
- if err != nil {
- t.Fatal(err)
- }
-
- list, ok := item.Val.(*ast.ListType)
- if !ok {
- t.Fatalf("node should be of type LiteralType, got: %T", item.Val)
- }
-
- if len(list.List) != len(l.comment) {
- t.Fatalf("bad: %d", len(list.List))
- }
-
- for i, li := range list.List {
- lt := li.(*ast.LiteralType)
- comment := l.comment[i]
-
- if (lt.LineComment == nil) != (comment == "") {
- t.Fatalf("bad: %s", lt)
- }
-
- if comment == "" {
- continue
- }
-
- actual := lt.LineComment.List[0].Text
- if actual != comment {
- t.Fatalf("bad: %q %q", actual, comment)
- }
- }
- }
-}
-
-func TestObjectType(t *testing.T) {
- var literals = []struct {
- src string
- nodeType []ast.Node
- itemLen int
- }{
- {
- `foo = {}`,
- nil,
- 0,
- },
- {
- `foo = {
- bar = "fatih"
- }`,
- []ast.Node{&ast.LiteralType{}},
- 1,
- },
- {
- `foo = {
- bar = "fatih"
- baz = ["arslan"]
- }`,
- []ast.Node{
- &ast.LiteralType{},
- &ast.ListType{},
- },
- 2,
- },
- {
- `foo = {
- bar {}
- }`,
- []ast.Node{
- &ast.ObjectType{},
- },
- 1,
- },
- {
- `foo {
- bar {}
- foo = true
- }`,
- []ast.Node{
- &ast.ObjectType{},
- &ast.LiteralType{},
- },
- 2,
- },
- }
-
- for _, l := range literals {
- t.Logf("Source: %s", l.src)
-
- p := newParser([]byte(l.src))
- // p.enableTrace = true
- item, err := p.objectItem()
- if err != nil {
- t.Error(err)
- continue
- }
-
- // we know that the ObjectKey name is foo for all cases, what matters
- // is the object
- obj, ok := item.Val.(*ast.ObjectType)
- if !ok {
- t.Errorf("node should be of type LiteralType, got: %T", item.Val)
- continue
- }
-
- // check if the total length of items are correct
- equals(t, l.itemLen, len(obj.List.Items))
-
- // check if the types are correct
- for i, item := range obj.List.Items {
- equals(t, reflect.TypeOf(l.nodeType[i]), reflect.TypeOf(item.Val))
- }
- }
-}
-
-func TestObjectKey(t *testing.T) {
- keys := []struct {
- exp []token.Type
- src string
- }{
- {[]token.Type{token.IDENT}, `foo {}`},
- {[]token.Type{token.IDENT}, `foo = {}`},
- {[]token.Type{token.IDENT}, `foo = bar`},
- {[]token.Type{token.IDENT}, `foo = 123`},
- {[]token.Type{token.IDENT}, `foo = "${var.bar}`},
- {[]token.Type{token.STRING}, `"foo" {}`},
- {[]token.Type{token.STRING}, `"foo" = {}`},
- {[]token.Type{token.STRING}, `"foo" = "${var.bar}`},
- {[]token.Type{token.IDENT, token.IDENT}, `foo bar {}`},
- {[]token.Type{token.IDENT, token.STRING}, `foo "bar" {}`},
- {[]token.Type{token.STRING, token.IDENT}, `"foo" bar {}`},
- {[]token.Type{token.IDENT, token.IDENT, token.IDENT}, `foo bar baz {}`},
- }
-
- for _, k := range keys {
- p := newParser([]byte(k.src))
- keys, err := p.objectKey()
- if err != nil {
- t.Fatal(err)
- }
-
- tokens := []token.Type{}
- for _, o := range keys {
- tokens = append(tokens, o.Token.Type)
- }
-
- equals(t, k.exp, tokens)
- }
-
- errKeys := []struct {
- src string
- }{
- {`foo 12 {}`},
- {`foo bar = {}`},
- {`foo []`},
- {`12 {}`},
- }
-
- for _, k := range errKeys {
- p := newParser([]byte(k.src))
- _, err := p.objectKey()
- if err == nil {
- t.Errorf("case '%s' should give an error", k.src)
- }
- }
-}
-
-func TestCommentGroup(t *testing.T) {
- var cases = []struct {
- src string
- groups int
- }{
- {"# Hello\n# World", 1},
- {"# Hello\r\n# Windows", 1},
- }
-
- for _, tc := range cases {
- t.Run(tc.src, func(t *testing.T) {
- p := newParser([]byte(tc.src))
- file, err := p.Parse()
- if err != nil {
- t.Fatalf("parse error: %s", err)
- }
-
- if len(file.Comments) != tc.groups {
- t.Fatalf("bad: %#v", file.Comments)
- }
- })
- }
-}
-
-// Official HCL tests
-func TestParse(t *testing.T) {
- cases := []struct {
- Name string
- Err bool
- }{
- {
- "assign_colon.hcl",
- true,
- },
- {
- "comment.hcl",
- false,
- },
- {
- "comment_crlf.hcl",
- false,
- },
- {
- "comment_lastline.hcl",
- false,
- },
- {
- "comment_single.hcl",
- false,
- },
- {
- "empty.hcl",
- false,
- },
- {
- "list_comma.hcl",
- false,
- },
- {
- "multiple.hcl",
- false,
- },
- {
- "object_list_comma.hcl",
- false,
- },
- {
- "structure.hcl",
- false,
- },
- {
- "structure_basic.hcl",
- false,
- },
- {
- "structure_empty.hcl",
- false,
- },
- {
- "complex.hcl",
- false,
- },
- {
- "complex_crlf.hcl",
- false,
- },
- {
- "types.hcl",
- false,
- },
- {
- "array_comment.hcl",
- false,
- },
- {
- "array_comment_2.hcl",
- true,
- },
- {
- "missing_braces.hcl",
- true,
- },
- {
- "unterminated_object.hcl",
- true,
- },
- {
- "unterminated_object_2.hcl",
- true,
- },
- {
- "key_without_value.hcl",
- true,
- },
- {
- "object_key_without_value.hcl",
- true,
- },
- {
- "object_key_assign_without_value.hcl",
- true,
- },
- {
- "object_key_assign_without_value2.hcl",
- true,
- },
- {
- "object_key_assign_without_value3.hcl",
- true,
- },
- {
- "git_crypt.hcl",
- true,
- },
- }
-
- const fixtureDir = "./test-fixtures"
-
- for _, tc := range cases {
- t.Run(tc.Name, func(t *testing.T) {
- d, err := ioutil.ReadFile(filepath.Join(fixtureDir, tc.Name))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- v, err := Parse(d)
- if (err != nil) != tc.Err {
- t.Fatalf("Input: %s\n\nError: %s\n\nAST: %#v", tc.Name, err, v)
- }
- })
- }
-}
-
-func TestParse_inline(t *testing.T) {
- cases := []struct {
- Value string
- Err bool
- }{
- {"t t e{{}}", true},
- {"o{{}}", true},
- {"t t e d N{{}}", true},
- {"t t e d{{}}", true},
- {"N{}N{{}}", true},
- {"v\nN{{}}", true},
- {"v=/\n[,", true},
- {"v=10kb", true},
- {"v=/foo", true},
- }
-
- for _, tc := range cases {
- t.Logf("Testing: %q", tc.Value)
- ast, err := Parse([]byte(tc.Value))
- if (err != nil) != tc.Err {
- t.Fatalf("Input: %q\n\nError: %s\n\nAST: %#v", tc.Value, err, ast)
- }
- }
-}
-
-// equals fails the test if exp is not equal to act.
-func equals(tb testing.TB, exp, act interface{}) {
- if !reflect.DeepEqual(exp, act) {
- _, file, line, _ := runtime.Caller(1)
- fmt.Printf("\033[31m%s:%d:\n\n\texp: %#v\n\n\tgot: %#v\033[39m\n\n", filepath.Base(file), line, exp, act)
- tb.FailNow()
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/array_comment.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/array_comment.hcl
deleted file mode 100644
index 78c267582..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/array_comment.hcl
+++ /dev/null
@@ -1,4 +0,0 @@
-foo = [
- "1",
- "2", # comment
-]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/array_comment_2.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/array_comment_2.hcl
deleted file mode 100644
index f91667738..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/array_comment_2.hcl
+++ /dev/null
@@ -1,6 +0,0 @@
-provisioner "remote-exec" {
- scripts = [
- "${path.module}/scripts/install-consul.sh" // missing comma
- "${path.module}/scripts/install-haproxy.sh"
- ]
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/assign_colon.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/assign_colon.hcl
deleted file mode 100644
index eb5a99a69..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/assign_colon.hcl
+++ /dev/null
@@ -1,6 +0,0 @@
-resource = [{
- "foo": {
- "bar": {},
- "baz": [1, 2, "foo"],
- }
-}]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/assign_deep.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/assign_deep.hcl
deleted file mode 100644
index dd3151cb7..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/assign_deep.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-resource = [{
- foo = [{
- bar = {}
- }]
-}]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment.hcl
deleted file mode 100644
index e32be87ed..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment.hcl
+++ /dev/null
@@ -1,15 +0,0 @@
-// Foo
-
-/* Bar */
-
-/*
-/*
-Baz
-*/
-
-# Another
-
-# Multiple
-# Lines
-
-foo = "bar"
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment_crlf.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment_crlf.hcl
deleted file mode 100644
index 1ff7f29fd..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment_crlf.hcl
+++ /dev/null
@@ -1,15 +0,0 @@
-// Foo
-
-/* Bar */
-
-/*
-/*
-Baz
-*/
-
-# Another
-
-# Multiple
-# Lines
-
-foo = "bar"
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment_lastline.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment_lastline.hcl
deleted file mode 100644
index 5529b9b4c..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment_lastline.hcl
+++ /dev/null
@@ -1 +0,0 @@
-#foo \ No newline at end of file
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment_single.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment_single.hcl
deleted file mode 100644
index fec56017d..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/comment_single.hcl
+++ /dev/null
@@ -1 +0,0 @@
-# Hello
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/complex.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/complex.hcl
deleted file mode 100644
index 13b3c2726..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/complex.hcl
+++ /dev/null
@@ -1,42 +0,0 @@
-variable "foo" {
- default = "bar"
- description = "bar"
-}
-
-variable "groups" { }
-
-provider "aws" {
- access_key = "foo"
- secret_key = "bar"
-}
-
-provider "do" {
- api_key = "${var.foo}"
-}
-
-resource "aws_security_group" "firewall" {
- count = 5
-}
-
-resource aws_instance "web" {
- ami = "${var.foo}"
- security_groups = [
- "foo",
- "${aws_security_group.firewall.foo}",
- "${element(split(\",\", var.groups)}",
- ]
- network_interface = {
- device_index = 0
- description = "Main network interface"
- }
-}
-
-resource "aws_instance" "db" {
- security_groups = "${aws_security_group.firewall.*.id}"
- VPC = "foo"
- depends_on = ["aws_instance.web"]
-}
-
-output "web_ip" {
- value = "${aws_instance.web.private_ip}"
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/complex_crlf.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/complex_crlf.hcl
deleted file mode 100644
index 9b071d12b..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/complex_crlf.hcl
+++ /dev/null
@@ -1,42 +0,0 @@
-variable "foo" {
- default = "bar"
- description = "bar"
-}
-
-variable "groups" { }
-
-provider "aws" {
- access_key = "foo"
- secret_key = "bar"
-}
-
-provider "do" {
- api_key = "${var.foo}"
-}
-
-resource "aws_security_group" "firewall" {
- count = 5
-}
-
-resource aws_instance "web" {
- ami = "${var.foo}"
- security_groups = [
- "foo",
- "${aws_security_group.firewall.foo}",
- "${element(split(\",\", var.groups)}",
- ]
- network_interface = {
- device_index = 0
- description = "Main network interface"
- }
-}
-
-resource "aws_instance" "db" {
- security_groups = "${aws_security_group.firewall.*.id}"
- VPC = "foo"
- depends_on = ["aws_instance.web"]
-}
-
-output "web_ip" {
- value = "${aws_instance.web.private_ip}"
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/complex_key.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/complex_key.hcl
deleted file mode 100644
index 0007aaf5f..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/complex_key.hcl
+++ /dev/null
@@ -1 +0,0 @@
-foo.bar = "baz"
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/empty.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/empty.hcl
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/empty.hcl
+++ /dev/null
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/git_crypt.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/git_crypt.hcl
deleted file mode 100644
index f691948e1..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/git_crypt.hcl
+++ /dev/null
Binary files differ
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/key_without_value.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/key_without_value.hcl
deleted file mode 100644
index 257cc5642..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/key_without_value.hcl
+++ /dev/null
@@ -1 +0,0 @@
-foo
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/list.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/list.hcl
deleted file mode 100644
index 059d4ce65..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/list.hcl
+++ /dev/null
@@ -1 +0,0 @@
-foo = [1, 2, "foo"]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/list_comma.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/list_comma.hcl
deleted file mode 100644
index 50f4218ac..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/list_comma.hcl
+++ /dev/null
@@ -1 +0,0 @@
-foo = [1, 2, "foo",]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/missing_braces.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/missing_braces.hcl
deleted file mode 100644
index 68e7274e6..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/missing_braces.hcl
+++ /dev/null
@@ -1,4 +0,0 @@
-# should error, but not crash
-resource "template_file" "cloud_config" {
- template = "$file("${path.module}/some/path")"
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/multiple.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/multiple.hcl
deleted file mode 100644
index 029c54b0c..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/multiple.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-foo = "bar"
-key = 7
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_assign_without_value.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_assign_without_value.hcl
deleted file mode 100644
index 37a2c7a06..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_assign_without_value.hcl
+++ /dev/null
@@ -1,3 +0,0 @@
-foo {
- bar =
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_assign_without_value2.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_assign_without_value2.hcl
deleted file mode 100644
index 83ec5e66e..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_assign_without_value2.hcl
+++ /dev/null
@@ -1,4 +0,0 @@
-foo {
- baz = 7
- bar =
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_assign_without_value3.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_assign_without_value3.hcl
deleted file mode 100644
index 21136d1d5..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_assign_without_value3.hcl
+++ /dev/null
@@ -1,4 +0,0 @@
-foo {
- bar =
- baz = 7
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_without_value.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_without_value.hcl
deleted file mode 100644
index a9987318c..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_key_without_value.hcl
+++ /dev/null
@@ -1,3 +0,0 @@
-foo {
- bar
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_list_comma.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_list_comma.hcl
deleted file mode 100644
index 1921ec8f2..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/object_list_comma.hcl
+++ /dev/null
@@ -1 +0,0 @@
-foo = {one = 1, two = 2}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/old.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/old.hcl
deleted file mode 100644
index e9f77cae9..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/old.hcl
+++ /dev/null
@@ -1,3 +0,0 @@
-default = {
- "eu-west-1": "ami-b1cf19c6",
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/structure.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/structure.hcl
deleted file mode 100644
index 92592fbb3..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/structure.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-// This is a test structure for the lexer
-foo bar "baz" {
- key = 7
- foo = "bar"
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/structure_basic.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/structure_basic.hcl
deleted file mode 100644
index 7229a1f01..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/structure_basic.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-foo {
- value = 7
- "value" = 8
- "complex::value" = 9
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/structure_empty.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/structure_empty.hcl
deleted file mode 100644
index 4d156ddea..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/structure_empty.hcl
+++ /dev/null
@@ -1 +0,0 @@
-resource "foo" "bar" {}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/types.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/types.hcl
deleted file mode 100644
index cf2747ea1..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/types.hcl
+++ /dev/null
@@ -1,7 +0,0 @@
-foo = "bar"
-bar = 7
-baz = [1,2,3]
-foo = -12
-bar = 3.14159
-foo = true
-bar = false
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/unterminated_object.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/unterminated_object.hcl
deleted file mode 100644
index 31b37c4f9..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/unterminated_object.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-foo "baz" {
- bar = "baz"
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/unterminated_object_2.hcl b/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/unterminated_object_2.hcl
deleted file mode 100644
index 294e36d65..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/test-fixtures/unterminated_object_2.hcl
+++ /dev/null
@@ -1,6 +0,0 @@
-resource "aws_eip" "EIP1" { a { a { a { a { a {
- count = "1"
-
-resource "aws_eip" "EIP2" {
- count = "1"
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go b/vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go
index c896d5844..7c038d12a 100644
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go
+++ b/vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go
@@ -252,6 +252,14 @@ func (p *printer) objectItem(o *ast.ObjectItem) []byte {
}
}
+ // If key and val are on different lines, treat line comments like lead comments.
+ if o.LineComment != nil && o.Val.Pos().Line != o.Keys[0].Pos().Line {
+ for _, comment := range o.LineComment.List {
+ buf.WriteString(comment.Text)
+ buf.WriteByte(newline)
+ }
+ }
+
for i, k := range o.Keys {
buf.WriteString(k.Token.Text)
buf.WriteByte(blank)
@@ -265,7 +273,7 @@ func (p *printer) objectItem(o *ast.ObjectItem) []byte {
buf.Write(p.output(o.Val))
- if o.Val.Pos().Line == o.Keys[0].Pos().Line && o.LineComment != nil {
+ if o.LineComment != nil && o.Val.Pos().Line == o.Keys[0].Pos().Line {
buf.WriteByte(blank)
for _, comment := range o.LineComment.List {
buf.WriteString(comment.Text)
@@ -509,8 +517,13 @@ func (p *printer) alignedItems(items []*ast.ObjectItem) []byte {
// list returns the printable HCL form of an list type.
func (p *printer) list(l *ast.ListType) []byte {
+ if p.isSingleLineList(l) {
+ return p.singleLineList(l)
+ }
+
var buf bytes.Buffer
buf.WriteString("[")
+ buf.WriteByte(newline)
var longestLine int
for _, item := range l.List {
@@ -523,115 +536,112 @@ func (p *printer) list(l *ast.ListType) []byte {
}
}
- insertSpaceBeforeItem := false
- lastHadLeadComment := false
+ haveEmptyLine := false
for i, item := range l.List {
- // Keep track of whether this item is a heredoc since that has
- // unique behavior.
- heredoc := false
- if lit, ok := item.(*ast.LiteralType); ok && lit.Token.Type == token.HEREDOC {
- heredoc = true
- }
-
- if item.Pos().Line != l.Lbrack.Line {
- // multiline list, add newline before we add each item
- buf.WriteByte(newline)
- insertSpaceBeforeItem = false
-
- // If we have a lead comment, then we want to write that first
- leadComment := false
- if lit, ok := item.(*ast.LiteralType); ok && lit.LeadComment != nil {
- leadComment = true
-
- // If this isn't the first item and the previous element
- // didn't have a lead comment, then we need to add an extra
- // newline to properly space things out. If it did have a
- // lead comment previously then this would be done
- // automatically.
- if i > 0 && !lastHadLeadComment {
- buf.WriteByte(newline)
- }
-
- for _, comment := range lit.LeadComment.List {
- buf.Write(p.indent([]byte(comment.Text)))
- buf.WriteByte(newline)
- }
+ // If we have a lead comment, then we want to write that first
+ leadComment := false
+ if lit, ok := item.(*ast.LiteralType); ok && lit.LeadComment != nil {
+ leadComment = true
+
+ // Ensure an empty line before every element with a
+ // lead comment (except the first item in a list).
+ if !haveEmptyLine && i != 0 {
+ buf.WriteByte(newline)
}
- // also indent each line
- val := p.output(item)
- curLen := len(val)
- buf.Write(p.indent(val))
-
- // if this item is a heredoc, then we output the comma on
- // the next line. This is the only case this happens.
- comma := []byte{','}
- if heredoc {
+ for _, comment := range lit.LeadComment.List {
+ buf.Write(p.indent([]byte(comment.Text)))
buf.WriteByte(newline)
- comma = p.indent(comma)
}
+ }
- buf.Write(comma)
+ // also indent each line
+ val := p.output(item)
+ curLen := len(val)
+ buf.Write(p.indent(val))
- if lit, ok := item.(*ast.LiteralType); ok && lit.LineComment != nil {
- // if the next item doesn't have any comments, do not align
- buf.WriteByte(blank) // align one space
- for i := 0; i < longestLine-curLen; i++ {
- buf.WriteByte(blank)
- }
+ // if this item is a heredoc, then we output the comma on
+ // the next line. This is the only case this happens.
+ comma := []byte{','}
+ if lit, ok := item.(*ast.LiteralType); ok && lit.Token.Type == token.HEREDOC {
+ buf.WriteByte(newline)
+ comma = p.indent(comma)
+ }
- for _, comment := range lit.LineComment.List {
- buf.WriteString(comment.Text)
- }
- }
+ buf.Write(comma)
- lastItem := i == len(l.List)-1
- if lastItem {
- buf.WriteByte(newline)
+ if lit, ok := item.(*ast.LiteralType); ok && lit.LineComment != nil {
+ // if the next item doesn't have any comments, do not align
+ buf.WriteByte(blank) // align one space
+ for i := 0; i < longestLine-curLen; i++ {
+ buf.WriteByte(blank)
}
- if leadComment && !lastItem {
- buf.WriteByte(newline)
+ for _, comment := range lit.LineComment.List {
+ buf.WriteString(comment.Text)
}
+ }
- lastHadLeadComment = leadComment
- } else {
- if insertSpaceBeforeItem {
- buf.WriteByte(blank)
- insertSpaceBeforeItem = false
- }
+ buf.WriteByte(newline)
- // Output the item itself
- // also indent each line
- val := p.output(item)
- curLen := len(val)
- buf.Write(val)
+ // Ensure an empty line after every element with a
+ // lead comment (except the first item in a list).
+ haveEmptyLine = leadComment && i != len(l.List)-1
+ if haveEmptyLine {
+ buf.WriteByte(newline)
+ }
+ }
- // If this is a heredoc item we always have to output a newline
- // so that it parses properly.
- if heredoc {
- buf.WriteByte(newline)
- }
+ buf.WriteString("]")
+ return buf.Bytes()
+}
- // If this isn't the last element, write a comma.
- if i != len(l.List)-1 {
- buf.WriteString(",")
- insertSpaceBeforeItem = true
- }
+// isSingleLineList returns true if:
+// * they were previously formatted entirely on one line
+// * they consist entirely of literals
+// * there are either no heredoc strings or the list has exactly one element
+// * there are no line comments
+func (printer) isSingleLineList(l *ast.ListType) bool {
+ for _, item := range l.List {
+ if item.Pos().Line != l.Lbrack.Line {
+ return false
+ }
- if lit, ok := item.(*ast.LiteralType); ok && lit.LineComment != nil {
- // if the next item doesn't have any comments, do not align
- buf.WriteByte(blank) // align one space
- for i := 0; i < longestLine-curLen; i++ {
- buf.WriteByte(blank)
- }
+ lit, ok := item.(*ast.LiteralType)
+ if !ok {
+ return false
+ }
- for _, comment := range lit.LineComment.List {
- buf.WriteString(comment.Text)
- }
- }
+ if lit.Token.Type == token.HEREDOC && len(l.List) != 1 {
+ return false
+ }
+
+ if lit.LineComment != nil {
+ return false
+ }
+ }
+
+ return true
+}
+
+// singleLineList prints a simple single line list.
+// For a definition of "simple", see isSingleLineList above.
+func (p *printer) singleLineList(l *ast.ListType) []byte {
+ buf := &bytes.Buffer{}
+
+ buf.WriteString("[")
+ for i, item := range l.List {
+ if i != 0 {
+ buf.WriteString(", ")
}
+ // Output the item itself
+ buf.Write(p.output(item))
+
+ // The heredoc marker needs to be at the end of line.
+ if lit, ok := item.(*ast.LiteralType); ok && lit.Token.Type == token.HEREDOC {
+ buf.WriteByte(newline)
+ }
}
buf.WriteString("]")
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/printer_test.go b/vendor/github.com/hashicorp/hcl/hcl/printer/printer_test.go
deleted file mode 100644
index 5248259b9..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/printer_test.go
+++ /dev/null
@@ -1,149 +0,0 @@
-package printer
-
-import (
- "bytes"
- "errors"
- "flag"
- "fmt"
- "io/ioutil"
- "path/filepath"
- "testing"
-
- "github.com/hashicorp/hcl/hcl/parser"
-)
-
-var update = flag.Bool("update", false, "update golden files")
-
-const (
- dataDir = "testdata"
-)
-
-type entry struct {
- source, golden string
-}
-
-// Use go test -update to create/update the respective golden files.
-var data = []entry{
- {"complexhcl.input", "complexhcl.golden"},
- {"list.input", "list.golden"},
- {"list_comment.input", "list_comment.golden"},
- {"comment.input", "comment.golden"},
- {"comment_crlf.input", "comment.golden"},
- {"comment_aligned.input", "comment_aligned.golden"},
- {"comment_array.input", "comment_array.golden"},
- {"comment_end_file.input", "comment_end_file.golden"},
- {"comment_multiline_indent.input", "comment_multiline_indent.golden"},
- {"comment_multiline_no_stanza.input", "comment_multiline_no_stanza.golden"},
- {"comment_multiline_stanza.input", "comment_multiline_stanza.golden"},
- {"comment_newline.input", "comment_newline.golden"},
- {"comment_object_multi.input", "comment_object_multi.golden"},
- {"comment_standalone.input", "comment_standalone.golden"},
- {"empty_block.input", "empty_block.golden"},
- {"list_of_objects.input", "list_of_objects.golden"},
- {"multiline_string.input", "multiline_string.golden"},
- {"object_singleline.input", "object_singleline.golden"},
- {"object_with_heredoc.input", "object_with_heredoc.golden"},
-}
-
-func TestFiles(t *testing.T) {
- for _, e := range data {
- source := filepath.Join(dataDir, e.source)
- golden := filepath.Join(dataDir, e.golden)
- t.Run(e.source, func(t *testing.T) {
- check(t, source, golden)
- })
- }
-}
-
-func check(t *testing.T, source, golden string) {
- src, err := ioutil.ReadFile(source)
- if err != nil {
- t.Error(err)
- return
- }
-
- res, err := format(src)
- if err != nil {
- t.Error(err)
- return
- }
-
- // update golden files if necessary
- if *update {
- if err := ioutil.WriteFile(golden, res, 0644); err != nil {
- t.Error(err)
- }
- return
- }
-
- // get golden
- gld, err := ioutil.ReadFile(golden)
- if err != nil {
- t.Error(err)
- return
- }
-
- // formatted source and golden must be the same
- if err := diff(source, golden, res, gld); err != nil {
- t.Error(err)
- return
- }
-}
-
-// diff compares a and b.
-func diff(aname, bname string, a, b []byte) error {
- var buf bytes.Buffer // holding long error message
-
- // compare lengths
- if len(a) != len(b) {
- fmt.Fprintf(&buf, "\nlength changed: len(%s) = %d, len(%s) = %d", aname, len(a), bname, len(b))
- }
-
- // compare contents
- line := 1
- offs := 1
- for i := 0; i < len(a) && i < len(b); i++ {
- ch := a[i]
- if ch != b[i] {
- fmt.Fprintf(&buf, "\n%s:%d:%d: %q", aname, line, i-offs+1, lineAt(a, offs))
- fmt.Fprintf(&buf, "\n%s:%d:%d: %q", bname, line, i-offs+1, lineAt(b, offs))
- fmt.Fprintf(&buf, "\n\n")
- break
- }
- if ch == '\n' {
- line++
- offs = i + 1
- }
- }
-
- if buf.Len() > 0 {
- return errors.New(buf.String())
- }
- return nil
-}
-
-// format parses src, prints the corresponding AST, verifies the resulting
-// src is syntactically correct, and returns the resulting src or an error
-// if any.
-func format(src []byte) ([]byte, error) {
- formatted, err := Format(src)
- if err != nil {
- return nil, err
- }
-
- // make sure formatted output is syntactically correct
- if _, err := parser.Parse(formatted); err != nil {
- return nil, fmt.Errorf("parse: %s\n%s", err, formatted)
- }
-
- return formatted, nil
-}
-
-// lineAt returns the line in text starting at offset offs.
-func lineAt(text []byte, offs int) []byte {
- i := offs
- for i < len(text) && text[i] != '\n' {
- i++
- }
- return text[offs:i]
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.golden
deleted file mode 100644
index 9d4b072a0..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.golden
+++ /dev/null
@@ -1,36 +0,0 @@
-// A standalone comment is a comment which is not attached to any kind of node
-
-// This comes from Terraform, as a test
-variable "foo" {
- # Standalone comment should be still here
-
- default = "bar"
- description = "bar" # yooo
-}
-
-/* This is a multi line standalone
-comment*/
-
-// fatih arslan
-/* This is a developer test
-account and a multine comment */
-developer = ["fatih", "arslan"] // fatih arslan
-
-# One line here
-numbers = [1, 2] // another line here
-
-# Another comment
-variable = {
- description = "bar" # another yooo
-
- foo {
- # Nested standalone
-
- bar = "fatih"
- }
-}
-
-// lead comment
-foo {
- bar = "fatih" // line comment 2
-} // line comment 3
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.input
deleted file mode 100644
index 57c37ac1d..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment.input
+++ /dev/null
@@ -1,37 +0,0 @@
-// A standalone comment is a comment which is not attached to any kind of node
-
- // This comes from Terraform, as a test
-variable "foo" {
- # Standalone comment should be still here
-
- default = "bar"
- description = "bar" # yooo
-}
-
-/* This is a multi line standalone
-comment*/
-
-
-// fatih arslan
-/* This is a developer test
-account and a multine comment */
-developer = [ "fatih", "arslan"] // fatih arslan
-
-# One line here
-numbers = [1,2] // another line here
-
- # Another comment
-variable = {
- description = "bar" # another yooo
- foo {
- # Nested standalone
-
- bar = "fatih"
- }
-}
-
- // lead comment
-foo {
- bar = "fatih" // line comment 2
-} // line comment 3
-
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.golden
deleted file mode 100644
index 6ff21504c..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.golden
+++ /dev/null
@@ -1,32 +0,0 @@
-aligned {
- # We have some aligned items below
- foo = "fatih" # yoo1
- default = "bar" # yoo2
- bar = "bar and foo" # yoo3
-
- default = {
- bar = "example"
- }
-
- #deneme arslan
- fatih = ["fatih"] # yoo4
-
- #fatih arslan
- fatiharslan = ["arslan"] // yoo5
-
- default = {
- bar = "example"
- }
-
- security_groups = [
- "foo", # kenya 1
- "${aws_security_group.firewall.foo}", # kenya 2
- ]
-
- security_groups2 = [
- "foo", # kenya 1
- "bar", # kenya 1.5
- "${aws_security_group.firewall.foo}", # kenya 2
- "foobar", # kenya 3
- ]
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.input
deleted file mode 100644
index bd43ab1ad..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_aligned.input
+++ /dev/null
@@ -1,28 +0,0 @@
-aligned {
-# We have some aligned items below
- foo = "fatih" # yoo1
- default = "bar" # yoo2
- bar = "bar and foo" # yoo3
- default = {
- bar = "example"
- }
- #deneme arslan
- fatih = ["fatih"] # yoo4
- #fatih arslan
- fatiharslan = ["arslan"] // yoo5
- default = {
- bar = "example"
- }
-
-security_groups = [
- "foo", # kenya 1
- "${aws_security_group.firewall.foo}", # kenya 2
-]
-
-security_groups2 = [
- "foo", # kenya 1
- "bar", # kenya 1.5
- "${aws_security_group.firewall.foo}", # kenya 2
- "foobar", # kenya 3
-]
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.golden
deleted file mode 100644
index e778eafa3..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.golden
+++ /dev/null
@@ -1,13 +0,0 @@
-banana = [
- # I really want to comment this item in the array.
- "a",
-
- # This as well
- "b",
-
- "c", # And C
- "d",
-
- # And another
- "e",
-]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.input
deleted file mode 100644
index e778eafa3..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_array.input
+++ /dev/null
@@ -1,13 +0,0 @@
-banana = [
- # I really want to comment this item in the array.
- "a",
-
- # This as well
- "b",
-
- "c", # And C
- "d",
-
- # And another
- "e",
-]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_crlf.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_crlf.input
deleted file mode 100644
index 5d2720672..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_crlf.input
+++ /dev/null
@@ -1,37 +0,0 @@
-// A standalone comment is a comment which is not attached to any kind of node
-
- // This comes from Terraform, as a test
-variable "foo" {
- # Standalone comment should be still here
-
- default = "bar"
- description = "bar" # yooo
-}
-
-/* This is a multi line standalone
-comment*/
-
-
-// fatih arslan
-/* This is a developer test
-account and a multine comment */
-developer = [ "fatih", "arslan"] // fatih arslan
-
-# One line here
-numbers = [1,2] // another line here
-
- # Another comment
-variable = {
- description = "bar" # another yooo
- foo {
- # Nested standalone
-
- bar = "fatih"
- }
-}
-
- // lead comment
-foo {
- bar = "fatih" // line comment 2
-} // line comment 3
-
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.golden
deleted file mode 100644
index dbeae36a8..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.golden
+++ /dev/null
@@ -1,6 +0,0 @@
-resource "blah" "blah" {}
-
-//
-//
-//
-
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.input
deleted file mode 100644
index 68c4c282e..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_end_file.input
+++ /dev/null
@@ -1,5 +0,0 @@
-resource "blah" "blah" {}
-
-//
-//
-//
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_indent.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_indent.golden
deleted file mode 100644
index 74c4ccd89..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_indent.golden
+++ /dev/null
@@ -1,12 +0,0 @@
-resource "provider" "resource" {
- /*
- SPACE_SENSITIVE_CODE = <<EOF
-yaml code:
- foo: ""
- bar: ""
-EOF
- */
- /*
- OTHER
- */
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_indent.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_indent.input
deleted file mode 100644
index b07ac4d3c..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_indent.input
+++ /dev/null
@@ -1,13 +0,0 @@
-resource "provider" "resource" {
- /*
- SPACE_SENSITIVE_CODE = <<EOF
-yaml code:
- foo: ""
- bar: ""
-EOF
- */
-
- /*
- OTHER
- */
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_no_stanza.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_no_stanza.golden
deleted file mode 100644
index 7ad7ca296..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_no_stanza.golden
+++ /dev/null
@@ -1,7 +0,0 @@
-# This is a multiline comment
-# That has values like this:
-#
-# ami-abcd1234
-#
-# Do not delete this comment
-
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_no_stanza.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_no_stanza.input
deleted file mode 100644
index 8b818e91d..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_no_stanza.input
+++ /dev/null
@@ -1,6 +0,0 @@
-# This is a multiline comment
-# That has values like this:
-#
-# ami-abcd1234
-#
-# Do not delete this comment
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_stanza.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_stanza.golden
deleted file mode 100644
index e9db4f2ae..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_stanza.golden
+++ /dev/null
@@ -1,10 +0,0 @@
-# This is a multiline comment
-# That has values like this:
-#
-# ami-abcd1234
-#
-# Do not delete this comment
-
-resource "aws_instance" "web" {
- ami_id = "ami-abcd1234"
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_stanza.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_stanza.input
deleted file mode 100644
index 6a8b90230..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_multiline_stanza.input
+++ /dev/null
@@ -1,10 +0,0 @@
-# This is a multiline comment
-# That has values like this:
-#
-# ami-abcd1234
-#
-# Do not delete this comment
-
-resource "aws_instance" "web" {
-ami_id = "ami-abcd1234"
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_newline.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_newline.golden
deleted file mode 100644
index 2162c8845..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_newline.golden
+++ /dev/null
@@ -1,3 +0,0 @@
-# Hello
-# World
-
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_newline.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_newline.input
deleted file mode 100644
index aa56a9880..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_newline.input
+++ /dev/null
@@ -1,2 +0,0 @@
-# Hello
-# World
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_object_multi.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_object_multi.golden
deleted file mode 100644
index 4c0f0004a..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_object_multi.golden
+++ /dev/null
@@ -1,9 +0,0 @@
-variable "environment" {
- default = {}
-
- # default {
- # "region" = "us-west-2"
- # "sg" = "playground"
- # "env" = "prod"
- # }
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_object_multi.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_object_multi.input
deleted file mode 100644
index 4c0f0004a..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_object_multi.input
+++ /dev/null
@@ -1,9 +0,0 @@
-variable "environment" {
- default = {}
-
- # default {
- # "region" = "us-west-2"
- # "sg" = "playground"
- # "env" = "prod"
- # }
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.golden
deleted file mode 100644
index 3236d9e69..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.golden
+++ /dev/null
@@ -1,17 +0,0 @@
-// A standalone comment
-
-aligned {
- # Standalone 1
-
- a = "bar" # yoo1
- default = "bar" # yoo2
-
- # Standalone 2
-}
-
-# Standalone 3
-
-numbers = [1, 2] // another line here
-
-# Standalone 4
-
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.input
deleted file mode 100644
index 4436cb16c..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/comment_standalone.input
+++ /dev/null
@@ -1,16 +0,0 @@
-// A standalone comment
-
-aligned {
- # Standalone 1
-
- a = "bar" # yoo1
- default = "bar" # yoo2
-
- # Standalone 2
-}
-
- # Standalone 3
-
-numbers = [1,2] // another line here
-
- # Standalone 4
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/complexhcl.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/complexhcl.golden
deleted file mode 100644
index 198c32d28..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/complexhcl.golden
+++ /dev/null
@@ -1,54 +0,0 @@
-variable "foo" {
- default = "bar"
- description = "bar"
-}
-
-developer = ["fatih", "arslan"]
-
-provider "aws" {
- access_key = "foo"
- secret_key = "bar"
-}
-
-provider "do" {
- api_key = "${var.foo}"
-}
-
-resource "aws_security_group" "firewall" {
- count = 5
-}
-
-resource aws_instance "web" {
- ami = "${var.foo}"
-
- security_groups = [
- "foo",
- "${aws_security_group.firewall.foo}",
- ]
-
- network_interface {
- device_index = 0
- description = "Main network interface"
- }
-
- network_interface = {
- device_index = 1
-
- description = <<EOF
-ANOTHER NETWORK INTERFACE
-EOF
- }
-}
-
-resource "aws_instance" "db" {
- security_groups = "${aws_security_group.firewall.*.id}"
- VPC = "foo"
-
- depends_on = ["aws_instance.web"]
-}
-
-output "web_ip" {
- value = <<EOF
-TUBES
-EOF
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/complexhcl.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/complexhcl.input
deleted file mode 100644
index 712341840..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/complexhcl.input
+++ /dev/null
@@ -1,53 +0,0 @@
-variable "foo" {
- default = "bar"
- description = "bar"
-}
-
-developer = [ "fatih", "arslan"]
-
-provider "aws" {
- access_key ="foo"
- secret_key = "bar"
-}
-
- provider "do" {
- api_key = "${var.foo}"
-}
-
-resource "aws_security_group" "firewall" {
- count = 5
- }
-
- resource aws_instance "web" {
- ami = "${var.foo}"
- security_groups = [
- "foo",
- "${aws_security_group.firewall.foo}"
- ]
-
- network_interface {
- device_index = 0
- description = "Main network interface"
- }
-
- network_interface = {
- device_index = 1
- description = <<EOF
-ANOTHER NETWORK INTERFACE
-EOF
- }
- }
-
-resource "aws_instance" "db" {
- security_groups = "${aws_security_group.firewall.*.id}"
- VPC = "foo"
-
- depends_on = ["aws_instance.web"]
-}
-
-output "web_ip" {
-
- value=<<EOF
-TUBES
-EOF
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/empty_block.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/empty_block.golden
deleted file mode 100644
index 4ff1cb3e4..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/empty_block.golden
+++ /dev/null
@@ -1,12 +0,0 @@
-variable "foo" {}
-variable "foo" {}
-
-variable "foo" {
- # Standalone comment should be still here
-}
-
-foo {}
-
-foo {
- bar = "mssola"
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/empty_block.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/empty_block.input
deleted file mode 100644
index 627bf3e3f..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/empty_block.input
+++ /dev/null
@@ -1,14 +0,0 @@
-variable "foo" {}
-variable "foo" {
-}
-
-variable "foo" {
- # Standalone comment should be still here
-}
-
-foo {
-}
-
-foo {
- bar = "mssola"
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list.golden
deleted file mode 100644
index 14c37ac0f..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list.golden
+++ /dev/null
@@ -1,43 +0,0 @@
-foo = ["fatih", "arslan"]
-
-foo = ["bar", "qaz"]
-
-foo = ["zeynep",
- "arslan",
-]
-
-foo = ["fatih", "zeynep",
- "arslan",
-]
-
-foo = [
- "vim-go",
- "golang",
- "hcl",
-]
-
-foo = []
-
-foo = [1, 2, 3, 4]
-
-foo = [
- "kenya",
- "ethiopia",
- "columbia",
-]
-
-foo = [
- <<EOS
-one
-EOS
- ,
- <<EOS
-two
-EOS
- ,
-]
-
-foo = [<<EOS
-one
-EOS
-]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list.input
deleted file mode 100644
index f55a38200..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list.input
+++ /dev/null
@@ -1,37 +0,0 @@
-foo = ["fatih", "arslan" ]
-
-foo = [ "bar", "qaz", ]
-
-foo = [ "zeynep",
-"arslan", ]
-
-foo = ["fatih", "zeynep",
-"arslan", ]
-
-foo = [
- "vim-go",
- "golang", "hcl"]
-
-foo = []
-
-foo = [1, 2,3, 4]
-
-foo = [
- "kenya", "ethiopia",
- "columbia"]
-
-foo = [
- <<EOS
-one
-EOS
-,
- <<EOS
-two
-EOS
-,
- ]
-
-foo = [<<EOS
-one
-EOS
- ]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_comment.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_comment.golden
deleted file mode 100644
index e5753c91a..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_comment.golden
+++ /dev/null
@@ -1,7 +0,0 @@
-foo = [1, # Hello
- 2,
-]
-
-foo = [1, # Hello
- 2, # World
-]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_comment.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_comment.input
deleted file mode 100644
index 1d636c88d..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_comment.input
+++ /dev/null
@@ -1,6 +0,0 @@
-foo = [1, # Hello
-2]
-
-foo = [1, # Hello
-2, # World
-]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_of_objects.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_of_objects.golden
deleted file mode 100644
index 401ded6ef..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_of_objects.golden
+++ /dev/null
@@ -1,10 +0,0 @@
-list_of_objects = [
- {
- key1 = "value1"
- key2 = "value2"
- },
- {
- key3 = "value3"
- key4 = "value4"
- },
-]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_of_objects.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_of_objects.input
deleted file mode 100644
index f2adcf015..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/list_of_objects.input
+++ /dev/null
@@ -1,10 +0,0 @@
-list_of_objects = [
- {
- key1 = "value1"
- key2 = "value2"
- },
- {
- key3 = "value3"
- key4 = "value4"
- }
-] \ No newline at end of file
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/multiline_string.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/multiline_string.golden
deleted file mode 100644
index 3d10c741d..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/multiline_string.golden
+++ /dev/null
@@ -1,7 +0,0 @@
-resource "null_resource" "some_command" {
- provisioner "local-exec" {
- command = "${echo '
-some newlines
-and additonal output'}"
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/multiline_string.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/multiline_string.input
deleted file mode 100644
index 3d10c741d..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/multiline_string.input
+++ /dev/null
@@ -1,7 +0,0 @@
-resource "null_resource" "some_command" {
- provisioner "local-exec" {
- command = "${echo '
-some newlines
-and additonal output'}"
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_singleline.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_singleline.golden
deleted file mode 100644
index c3d914702..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_singleline.golden
+++ /dev/null
@@ -1,26 +0,0 @@
-variable "foo" {}
-variable "bar" {}
-variable "baz" {}
-
-variable "qux" {}
-
-variable "foo" {
- foo = "bar"
-}
-
-variable "foo" {}
-
-# lead comment
-variable "bar" {}
-
-variable "foo" {
- default = "bar"
-}
-
-variable "bar" {}
-
-# Purposeful newline check below:
-
-variable "foo" {}
-
-variable "purposeful-newline" {}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_singleline.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_singleline.input
deleted file mode 100644
index 7b34834a4..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_singleline.input
+++ /dev/null
@@ -1,19 +0,0 @@
-variable "foo" {}
-variable "bar" {}
-variable "baz" {}
-
-variable "qux" {}
-variable "foo" { foo = "bar" }
-
-variable "foo" {}
-# lead comment
-variable "bar" {}
-
-variable "foo" { default = "bar" }
-variable "bar" {}
-
-# Purposeful newline check below:
-
-variable "foo" {}
-
-variable "purposeful-newline" {}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_with_heredoc.golden b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_with_heredoc.golden
deleted file mode 100644
index 7e92243f6..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_with_heredoc.golden
+++ /dev/null
@@ -1,6 +0,0 @@
-obj {
- foo = [<<EOF
- TEXT!
-EOF
- ]
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_with_heredoc.input b/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_with_heredoc.input
deleted file mode 100644
index d70a05ac9..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/printer/testdata/object_with_heredoc.input
+++ /dev/null
@@ -1,6 +0,0 @@
-obj {
- foo = [<<EOF
- TEXT!
-EOF
- ]
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner.go b/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner.go
index 6601ef76e..624a18fe3 100644
--- a/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner.go
+++ b/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner.go
@@ -74,14 +74,6 @@ func (s *Scanner) next() rune {
return eof
}
- if ch == utf8.RuneError && size == 1 {
- s.srcPos.Column++
- s.srcPos.Offset += size
- s.lastCharLen = size
- s.err("illegal UTF-8 encoding")
- return ch
- }
-
// remember last position
s.prevPos = s.srcPos
@@ -89,18 +81,27 @@ func (s *Scanner) next() rune {
s.lastCharLen = size
s.srcPos.Offset += size
+ if ch == utf8.RuneError && size == 1 {
+ s.err("illegal UTF-8 encoding")
+ return ch
+ }
+
if ch == '\n' {
s.srcPos.Line++
s.lastLineLen = s.srcPos.Column
s.srcPos.Column = 0
}
- // If we see a null character with data left, then that is an error
- if ch == '\x00' && s.buf.Len() > 0 {
+ if ch == '\x00' {
s.err("unexpected null character (0x00)")
return eof
}
+ if ch == '\uE123' {
+ s.err("unicode code point U+E123 reserved for internal use")
+ return utf8.RuneError
+ }
+
// debug
// fmt.Printf("ch: %q, offset:column: %d:%d\n", ch, s.srcPos.Offset, s.srcPos.Column)
return ch
@@ -432,16 +433,16 @@ func (s *Scanner) scanHeredoc() {
// Read the identifier
identBytes := s.src[offs : s.srcPos.Offset-s.lastCharLen]
- if len(identBytes) == 0 {
+ if len(identBytes) == 0 || (len(identBytes) == 1 && identBytes[0] == '-') {
s.err("zero-length heredoc anchor")
return
}
var identRegexp *regexp.Regexp
if identBytes[0] == '-' {
- identRegexp = regexp.MustCompile(fmt.Sprintf(`[[:space:]]*%s\z`, identBytes[1:]))
+ identRegexp = regexp.MustCompile(fmt.Sprintf(`^[[:space:]]*%s\r*\z`, identBytes[1:]))
} else {
- identRegexp = regexp.MustCompile(fmt.Sprintf(`[[:space:]]*%s\z`, identBytes))
+ identRegexp = regexp.MustCompile(fmt.Sprintf(`^[[:space:]]*%s\r*\z`, identBytes))
}
// Read the actual string value
@@ -551,7 +552,7 @@ func (s *Scanner) scanDigits(ch rune, base, n int) rune {
s.err("illegal char escape")
}
- if n != start {
+ if n != start && ch != eof {
// we scanned all digits, put the last non digit char back,
// only if we read anything at all
s.unread()
diff --git a/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner_test.go b/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner_test.go
deleted file mode 100644
index 4f2c9cbe0..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner_test.go
+++ /dev/null
@@ -1,591 +0,0 @@
-package scanner
-
-import (
- "bytes"
- "fmt"
- "testing"
-
- "strings"
-
- "github.com/hashicorp/hcl/hcl/token"
-)
-
-var f100 = strings.Repeat("f", 100)
-
-type tokenPair struct {
- tok token.Type
- text string
-}
-
-var tokenLists = map[string][]tokenPair{
- "comment": []tokenPair{
- {token.COMMENT, "//"},
- {token.COMMENT, "////"},
- {token.COMMENT, "// comment"},
- {token.COMMENT, "// /* comment */"},
- {token.COMMENT, "// // comment //"},
- {token.COMMENT, "//" + f100},
- {token.COMMENT, "#"},
- {token.COMMENT, "##"},
- {token.COMMENT, "# comment"},
- {token.COMMENT, "# /* comment */"},
- {token.COMMENT, "# # comment #"},
- {token.COMMENT, "#" + f100},
- {token.COMMENT, "/**/"},
- {token.COMMENT, "/***/"},
- {token.COMMENT, "/* comment */"},
- {token.COMMENT, "/* // comment */"},
- {token.COMMENT, "/* /* comment */"},
- {token.COMMENT, "/*\n comment\n*/"},
- {token.COMMENT, "/*" + f100 + "*/"},
- },
- "operator": []tokenPair{
- {token.LBRACK, "["},
- {token.LBRACE, "{"},
- {token.COMMA, ","},
- {token.PERIOD, "."},
- {token.RBRACK, "]"},
- {token.RBRACE, "}"},
- {token.ASSIGN, "="},
- {token.ADD, "+"},
- {token.SUB, "-"},
- },
- "bool": []tokenPair{
- {token.BOOL, "true"},
- {token.BOOL, "false"},
- },
- "ident": []tokenPair{
- {token.IDENT, "a"},
- {token.IDENT, "a0"},
- {token.IDENT, "foobar"},
- {token.IDENT, "foo-bar"},
- {token.IDENT, "abc123"},
- {token.IDENT, "LGTM"},
- {token.IDENT, "_"},
- {token.IDENT, "_abc123"},
- {token.IDENT, "abc123_"},
- {token.IDENT, "_abc_123_"},
- {token.IDENT, "_äöü"},
- {token.IDENT, "_本"},
- {token.IDENT, "äöü"},
- {token.IDENT, "本"},
- {token.IDENT, "a۰۱۸"},
- {token.IDENT, "foo६४"},
- {token.IDENT, "bar9876"},
- },
- "heredoc": []tokenPair{
- {token.HEREDOC, "<<EOF\nhello\nworld\nEOF"},
- {token.HEREDOC, "<<EOF123\nhello\nworld\nEOF123"},
- },
- "string": []tokenPair{
- {token.STRING, `" "`},
- {token.STRING, `"a"`},
- {token.STRING, `"本"`},
- {token.STRING, `"${file("foo")}"`},
- {token.STRING, `"${file(\"foo\")}"`},
- {token.STRING, `"\a"`},
- {token.STRING, `"\b"`},
- {token.STRING, `"\f"`},
- {token.STRING, `"\n"`},
- {token.STRING, `"\r"`},
- {token.STRING, `"\t"`},
- {token.STRING, `"\v"`},
- {token.STRING, `"\""`},
- {token.STRING, `"\000"`},
- {token.STRING, `"\777"`},
- {token.STRING, `"\x00"`},
- {token.STRING, `"\xff"`},
- {token.STRING, `"\u0000"`},
- {token.STRING, `"\ufA16"`},
- {token.STRING, `"\U00000000"`},
- {token.STRING, `"\U0000ffAB"`},
- {token.STRING, `"` + f100 + `"`},
- },
- "number": []tokenPair{
- {token.NUMBER, "0"},
- {token.NUMBER, "1"},
- {token.NUMBER, "9"},
- {token.NUMBER, "42"},
- {token.NUMBER, "1234567890"},
- {token.NUMBER, "00"},
- {token.NUMBER, "01"},
- {token.NUMBER, "07"},
- {token.NUMBER, "042"},
- {token.NUMBER, "01234567"},
- {token.NUMBER, "0x0"},
- {token.NUMBER, "0x1"},
- {token.NUMBER, "0xf"},
- {token.NUMBER, "0x42"},
- {token.NUMBER, "0x123456789abcDEF"},
- {token.NUMBER, "0x" + f100},
- {token.NUMBER, "0X0"},
- {token.NUMBER, "0X1"},
- {token.NUMBER, "0XF"},
- {token.NUMBER, "0X42"},
- {token.NUMBER, "0X123456789abcDEF"},
- {token.NUMBER, "0X" + f100},
- {token.NUMBER, "-0"},
- {token.NUMBER, "-1"},
- {token.NUMBER, "-9"},
- {token.NUMBER, "-42"},
- {token.NUMBER, "-1234567890"},
- {token.NUMBER, "-00"},
- {token.NUMBER, "-01"},
- {token.NUMBER, "-07"},
- {token.NUMBER, "-29"},
- {token.NUMBER, "-042"},
- {token.NUMBER, "-01234567"},
- {token.NUMBER, "-0x0"},
- {token.NUMBER, "-0x1"},
- {token.NUMBER, "-0xf"},
- {token.NUMBER, "-0x42"},
- {token.NUMBER, "-0x123456789abcDEF"},
- {token.NUMBER, "-0x" + f100},
- {token.NUMBER, "-0X0"},
- {token.NUMBER, "-0X1"},
- {token.NUMBER, "-0XF"},
- {token.NUMBER, "-0X42"},
- {token.NUMBER, "-0X123456789abcDEF"},
- {token.NUMBER, "-0X" + f100},
- },
- "float": []tokenPair{
- {token.FLOAT, "0."},
- {token.FLOAT, "1."},
- {token.FLOAT, "42."},
- {token.FLOAT, "01234567890."},
- {token.FLOAT, ".0"},
- {token.FLOAT, ".1"},
- {token.FLOAT, ".42"},
- {token.FLOAT, ".0123456789"},
- {token.FLOAT, "0.0"},
- {token.FLOAT, "1.0"},
- {token.FLOAT, "42.0"},
- {token.FLOAT, "01234567890.0"},
- {token.FLOAT, "0e0"},
- {token.FLOAT, "1e0"},
- {token.FLOAT, "42e0"},
- {token.FLOAT, "01234567890e0"},
- {token.FLOAT, "0E0"},
- {token.FLOAT, "1E0"},
- {token.FLOAT, "42E0"},
- {token.FLOAT, "01234567890E0"},
- {token.FLOAT, "0e+10"},
- {token.FLOAT, "1e-10"},
- {token.FLOAT, "42e+10"},
- {token.FLOAT, "01234567890e-10"},
- {token.FLOAT, "0E+10"},
- {token.FLOAT, "1E-10"},
- {token.FLOAT, "42E+10"},
- {token.FLOAT, "01234567890E-10"},
- {token.FLOAT, "01.8e0"},
- {token.FLOAT, "1.4e0"},
- {token.FLOAT, "42.2e0"},
- {token.FLOAT, "01234567890.12e0"},
- {token.FLOAT, "0.E0"},
- {token.FLOAT, "1.12E0"},
- {token.FLOAT, "42.123E0"},
- {token.FLOAT, "01234567890.213E0"},
- {token.FLOAT, "0.2e+10"},
- {token.FLOAT, "1.2e-10"},
- {token.FLOAT, "42.54e+10"},
- {token.FLOAT, "01234567890.98e-10"},
- {token.FLOAT, "0.1E+10"},
- {token.FLOAT, "1.1E-10"},
- {token.FLOAT, "42.1E+10"},
- {token.FLOAT, "01234567890.1E-10"},
- {token.FLOAT, "-0.0"},
- {token.FLOAT, "-1.0"},
- {token.FLOAT, "-42.0"},
- {token.FLOAT, "-01234567890.0"},
- {token.FLOAT, "-0e0"},
- {token.FLOAT, "-1e0"},
- {token.FLOAT, "-42e0"},
- {token.FLOAT, "-01234567890e0"},
- {token.FLOAT, "-0E0"},
- {token.FLOAT, "-1E0"},
- {token.FLOAT, "-42E0"},
- {token.FLOAT, "-01234567890E0"},
- {token.FLOAT, "-0e+10"},
- {token.FLOAT, "-1e-10"},
- {token.FLOAT, "-42e+10"},
- {token.FLOAT, "-01234567890e-10"},
- {token.FLOAT, "-0E+10"},
- {token.FLOAT, "-1E-10"},
- {token.FLOAT, "-42E+10"},
- {token.FLOAT, "-01234567890E-10"},
- {token.FLOAT, "-01.8e0"},
- {token.FLOAT, "-1.4e0"},
- {token.FLOAT, "-42.2e0"},
- {token.FLOAT, "-01234567890.12e0"},
- {token.FLOAT, "-0.E0"},
- {token.FLOAT, "-1.12E0"},
- {token.FLOAT, "-42.123E0"},
- {token.FLOAT, "-01234567890.213E0"},
- {token.FLOAT, "-0.2e+10"},
- {token.FLOAT, "-1.2e-10"},
- {token.FLOAT, "-42.54e+10"},
- {token.FLOAT, "-01234567890.98e-10"},
- {token.FLOAT, "-0.1E+10"},
- {token.FLOAT, "-1.1E-10"},
- {token.FLOAT, "-42.1E+10"},
- {token.FLOAT, "-01234567890.1E-10"},
- },
-}
-
-var orderedTokenLists = []string{
- "comment",
- "operator",
- "bool",
- "ident",
- "heredoc",
- "string",
- "number",
- "float",
-}
-
-func TestPosition(t *testing.T) {
- // create artifical source code
- buf := new(bytes.Buffer)
-
- for _, listName := range orderedTokenLists {
- for _, ident := range tokenLists[listName] {
- fmt.Fprintf(buf, "\t\t\t\t%s\n", ident.text)
- }
- }
-
- s := New(buf.Bytes())
-
- pos := token.Pos{"", 4, 1, 5}
- s.Scan()
- for _, listName := range orderedTokenLists {
-
- for _, k := range tokenLists[listName] {
- curPos := s.tokPos
- // fmt.Printf("[%q] s = %+v:%+v\n", k.text, curPos.Offset, curPos.Column)
-
- if curPos.Offset != pos.Offset {
- t.Fatalf("offset = %d, want %d for %q", curPos.Offset, pos.Offset, k.text)
- }
- if curPos.Line != pos.Line {
- t.Fatalf("line = %d, want %d for %q", curPos.Line, pos.Line, k.text)
- }
- if curPos.Column != pos.Column {
- t.Fatalf("column = %d, want %d for %q", curPos.Column, pos.Column, k.text)
- }
- pos.Offset += 4 + len(k.text) + 1 // 4 tabs + token bytes + newline
- pos.Line += countNewlines(k.text) + 1 // each token is on a new line
- s.Scan()
- }
- }
- // make sure there were no token-internal errors reported by scanner
- if s.ErrorCount != 0 {
- t.Errorf("%d errors", s.ErrorCount)
- }
-}
-
-func TestNullChar(t *testing.T) {
- s := New([]byte("\"\\0"))
- s.Scan() // Used to panic
-}
-
-func TestComment(t *testing.T) {
- testTokenList(t, tokenLists["comment"])
-}
-
-func TestOperator(t *testing.T) {
- testTokenList(t, tokenLists["operator"])
-}
-
-func TestBool(t *testing.T) {
- testTokenList(t, tokenLists["bool"])
-}
-
-func TestIdent(t *testing.T) {
- testTokenList(t, tokenLists["ident"])
-}
-
-func TestString(t *testing.T) {
- testTokenList(t, tokenLists["string"])
-}
-
-func TestNumber(t *testing.T) {
- testTokenList(t, tokenLists["number"])
-}
-
-func TestFloat(t *testing.T) {
- testTokenList(t, tokenLists["float"])
-}
-
-func TestWindowsLineEndings(t *testing.T) {
- hcl := `// This should have Windows line endings
-resource "aws_instance" "foo" {
- user_data=<<HEREDOC
- test script
-HEREDOC
-}`
- hclWindowsEndings := strings.Replace(hcl, "\n", "\r\n", -1)
-
- literals := []struct {
- tokenType token.Type
- literal string
- }{
- {token.COMMENT, "// This should have Windows line endings\r"},
- {token.IDENT, `resource`},
- {token.STRING, `"aws_instance"`},
- {token.STRING, `"foo"`},
- {token.LBRACE, `{`},
- {token.IDENT, `user_data`},
- {token.ASSIGN, `=`},
- {token.HEREDOC, "<<HEREDOC\r\n test script\r\nHEREDOC\r\n"},
- {token.RBRACE, `}`},
- }
-
- s := New([]byte(hclWindowsEndings))
- for _, l := range literals {
- tok := s.Scan()
-
- if l.tokenType != tok.Type {
- t.Errorf("got: %s want %s for %s\n", tok, l.tokenType, tok.String())
- }
-
- if l.literal != tok.Text {
- t.Errorf("got:\n%v\nwant:\n%v\n", []byte(tok.Text), []byte(l.literal))
- }
- }
-}
-
-func TestRealExample(t *testing.T) {
- complexHCL := `// This comes from Terraform, as a test
- variable "foo" {
- default = "bar"
- description = "bar"
- }
-
- provider "aws" {
- access_key = "foo"
- secret_key = "${replace(var.foo, ".", "\\.")}"
- }
-
- resource "aws_security_group" "firewall" {
- count = 5
- }
-
- resource aws_instance "web" {
- ami = "${var.foo}"
- security_groups = [
- "foo",
- "${aws_security_group.firewall.foo}"
- ]
-
- network_interface {
- device_index = 0
- description = <<EOF
-Main interface
-EOF
- }
-
- network_interface {
- device_index = 1
- description = <<-EOF
- Outer text
- Indented text
- EOF
- }
- }`
-
- literals := []struct {
- tokenType token.Type
- literal string
- }{
- {token.COMMENT, `// This comes from Terraform, as a test`},
- {token.IDENT, `variable`},
- {token.STRING, `"foo"`},
- {token.LBRACE, `{`},
- {token.IDENT, `default`},
- {token.ASSIGN, `=`},
- {token.STRING, `"bar"`},
- {token.IDENT, `description`},
- {token.ASSIGN, `=`},
- {token.STRING, `"bar"`},
- {token.RBRACE, `}`},
- {token.IDENT, `provider`},
- {token.STRING, `"aws"`},
- {token.LBRACE, `{`},
- {token.IDENT, `access_key`},
- {token.ASSIGN, `=`},
- {token.STRING, `"foo"`},
- {token.IDENT, `secret_key`},
- {token.ASSIGN, `=`},
- {token.STRING, `"${replace(var.foo, ".", "\\.")}"`},
- {token.RBRACE, `}`},
- {token.IDENT, `resource`},
- {token.STRING, `"aws_security_group"`},
- {token.STRING, `"firewall"`},
- {token.LBRACE, `{`},
- {token.IDENT, `count`},
- {token.ASSIGN, `=`},
- {token.NUMBER, `5`},
- {token.RBRACE, `}`},
- {token.IDENT, `resource`},
- {token.IDENT, `aws_instance`},
- {token.STRING, `"web"`},
- {token.LBRACE, `{`},
- {token.IDENT, `ami`},
- {token.ASSIGN, `=`},
- {token.STRING, `"${var.foo}"`},
- {token.IDENT, `security_groups`},
- {token.ASSIGN, `=`},
- {token.LBRACK, `[`},
- {token.STRING, `"foo"`},
- {token.COMMA, `,`},
- {token.STRING, `"${aws_security_group.firewall.foo}"`},
- {token.RBRACK, `]`},
- {token.IDENT, `network_interface`},
- {token.LBRACE, `{`},
- {token.IDENT, `device_index`},
- {token.ASSIGN, `=`},
- {token.NUMBER, `0`},
- {token.IDENT, `description`},
- {token.ASSIGN, `=`},
- {token.HEREDOC, "<<EOF\nMain interface\nEOF\n"},
- {token.RBRACE, `}`},
- {token.IDENT, `network_interface`},
- {token.LBRACE, `{`},
- {token.IDENT, `device_index`},
- {token.ASSIGN, `=`},
- {token.NUMBER, `1`},
- {token.IDENT, `description`},
- {token.ASSIGN, `=`},
- {token.HEREDOC, "<<-EOF\n\t\t\tOuter text\n\t\t\t\tIndented text\n\t\t\tEOF\n"},
- {token.RBRACE, `}`},
- {token.RBRACE, `}`},
- {token.EOF, ``},
- }
-
- s := New([]byte(complexHCL))
- for _, l := range literals {
- tok := s.Scan()
- if l.tokenType != tok.Type {
- t.Errorf("got: %s want %s for %s\n", tok, l.tokenType, tok.String())
- }
-
- if l.literal != tok.Text {
- t.Errorf("got:\n%+v\n%s\n want:\n%+v\n%s\n", []byte(tok.String()), tok, []byte(l.literal), l.literal)
- }
- }
-
-}
-
-func TestScan_crlf(t *testing.T) {
- complexHCL := "foo {\r\n bar = \"baz\"\r\n}\r\n"
-
- literals := []struct {
- tokenType token.Type
- literal string
- }{
- {token.IDENT, `foo`},
- {token.LBRACE, `{`},
- {token.IDENT, `bar`},
- {token.ASSIGN, `=`},
- {token.STRING, `"baz"`},
- {token.RBRACE, `}`},
- {token.EOF, ``},
- }
-
- s := New([]byte(complexHCL))
- for _, l := range literals {
- tok := s.Scan()
- if l.tokenType != tok.Type {
- t.Errorf("got: %s want %s for %s\n", tok, l.tokenType, tok.String())
- }
-
- if l.literal != tok.Text {
- t.Errorf("got:\n%+v\n%s\n want:\n%+v\n%s\n", []byte(tok.String()), tok, []byte(l.literal), l.literal)
- }
- }
-
-}
-
-func TestError(t *testing.T) {
- testError(t, "\x80", "1:1", "illegal UTF-8 encoding", token.ILLEGAL)
- testError(t, "\xff", "1:1", "illegal UTF-8 encoding", token.ILLEGAL)
-
- testError(t, "ab\x80", "1:3", "illegal UTF-8 encoding", token.IDENT)
- testError(t, "abc\xff", "1:4", "illegal UTF-8 encoding", token.IDENT)
-
- testError(t, `"ab`+"\x80", "1:4", "illegal UTF-8 encoding", token.STRING)
- testError(t, `"abc`+"\xff", "1:5", "illegal UTF-8 encoding", token.STRING)
-
- testError(t, `01238`, "1:6", "illegal octal number", token.NUMBER)
- testError(t, `01238123`, "1:9", "illegal octal number", token.NUMBER)
- testError(t, `0x`, "1:3", "illegal hexadecimal number", token.NUMBER)
- testError(t, `0xg`, "1:3", "illegal hexadecimal number", token.NUMBER)
- testError(t, `'aa'`, "1:1", "illegal char", token.ILLEGAL)
-
- testError(t, `"`, "1:2", "literal not terminated", token.STRING)
- testError(t, `"abc`, "1:5", "literal not terminated", token.STRING)
- testError(t, `"abc`+"\n", "1:5", "literal not terminated", token.STRING)
- testError(t, `"${abc`+"\n", "2:1", "literal not terminated", token.STRING)
- testError(t, `/*/`, "1:4", "comment not terminated", token.COMMENT)
- testError(t, `/foo`, "1:1", "expected '/' for comment", token.COMMENT)
-}
-
-func testError(t *testing.T, src, pos, msg string, tok token.Type) {
- s := New([]byte(src))
-
- errorCalled := false
- s.Error = func(p token.Pos, m string) {
- if !errorCalled {
- if pos != p.String() {
- t.Errorf("pos = %q, want %q for %q", p, pos, src)
- }
-
- if m != msg {
- t.Errorf("msg = %q, want %q for %q", m, msg, src)
- }
- errorCalled = true
- }
- }
-
- tk := s.Scan()
- if tk.Type != tok {
- t.Errorf("tok = %s, want %s for %q", tk, tok, src)
- }
- if !errorCalled {
- t.Errorf("error handler not called for %q", src)
- }
- if s.ErrorCount == 0 {
- t.Errorf("count = %d, want > 0 for %q", s.ErrorCount, src)
- }
-}
-
-func testTokenList(t *testing.T, tokenList []tokenPair) {
- // create artifical source code
- buf := new(bytes.Buffer)
- for _, ident := range tokenList {
- fmt.Fprintf(buf, "%s\n", ident.text)
- }
-
- s := New(buf.Bytes())
- for _, ident := range tokenList {
- tok := s.Scan()
- if tok.Type != ident.tok {
- t.Errorf("tok = %q want %q for %q\n", tok, ident.tok, ident.text)
- }
-
- if tok.Text != ident.text {
- t.Errorf("text = %q want %q", tok.String(), ident.text)
- }
-
- }
-}
-
-func countNewlines(s string) int {
- n := 0
- for _, ch := range s {
- if ch == '\n' {
- n++
- }
- }
- return n
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/strconv/quote_test.go b/vendor/github.com/hashicorp/hcl/hcl/strconv/quote_test.go
deleted file mode 100644
index 65be375d9..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/strconv/quote_test.go
+++ /dev/null
@@ -1,96 +0,0 @@
-package strconv
-
-import "testing"
-
-type quoteTest struct {
- in string
- out string
- ascii string
-}
-
-var quotetests = []quoteTest{
- {"\a\b\f\r\n\t\v", `"\a\b\f\r\n\t\v"`, `"\a\b\f\r\n\t\v"`},
- {"\\", `"\\"`, `"\\"`},
- {"abc\xffdef", `"abc\xffdef"`, `"abc\xffdef"`},
- {"\u263a", `"☺"`, `"\u263a"`},
- {"\U0010ffff", `"\U0010ffff"`, `"\U0010ffff"`},
- {"\x04", `"\x04"`, `"\x04"`},
-}
-
-type unQuoteTest struct {
- in string
- out string
-}
-
-var unquotetests = []unQuoteTest{
- {`""`, ""},
- {`"a"`, "a"},
- {`"abc"`, "abc"},
- {`"☺"`, "☺"},
- {`"hello world"`, "hello world"},
- {`"\xFF"`, "\xFF"},
- {`"\377"`, "\377"},
- {`"\u1234"`, "\u1234"},
- {`"\U00010111"`, "\U00010111"},
- {`"\U0001011111"`, "\U0001011111"},
- {`"\a\b\f\n\r\t\v\\\""`, "\a\b\f\n\r\t\v\\\""},
- {`"'"`, "'"},
- {`"${file("foo")}"`, `${file("foo")}`},
- {`"${file("\"foo\"")}"`, `${file("\"foo\"")}`},
- {`"echo ${var.region}${element(split(",",var.zones),0)}"`,
- `echo ${var.region}${element(split(",",var.zones),0)}`},
- {`"${HH\\:mm\\:ss}"`, `${HH\\:mm\\:ss}`},
- {`"${\n}"`, `${\n}`},
-}
-
-var misquoted = []string{
- ``,
- `"`,
- `"a`,
- `"'`,
- `b"`,
- `"\"`,
- `"\9"`,
- `"\19"`,
- `"\129"`,
- `'\'`,
- `'\9'`,
- `'\19'`,
- `'\129'`,
- `'ab'`,
- `"\x1!"`,
- `"\U12345678"`,
- `"\z"`,
- "`",
- "`xxx",
- "`\"",
- `"\'"`,
- `'\"'`,
- "\"\n\"",
- "\"\\n\n\"",
- "'\n'",
- `"${"`,
- `"${foo{}"`,
- "\"${foo}\n\"",
-}
-
-func TestUnquote(t *testing.T) {
- for _, tt := range unquotetests {
- if out, err := Unquote(tt.in); err != nil || out != tt.out {
- t.Errorf("Unquote(%#q) = %q, %v want %q, nil", tt.in, out, err, tt.out)
- }
- }
-
- // run the quote tests too, backward
- for _, tt := range quotetests {
- if in, err := Unquote(tt.out); in != tt.in {
- t.Errorf("Unquote(%#q) = %q, %v, want %q, nil", tt.out, in, err, tt.in)
- }
- }
-
- for _, s := range misquoted {
- if out, err := Unquote(s); out != "" || err != ErrSyntax {
- t.Errorf("Unquote(%#q) = %q, %v want %q, %v", s, out, err, "", ErrSyntax)
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/array_comment.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/array_comment.hcl
deleted file mode 100644
index 78c267582..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/array_comment.hcl
+++ /dev/null
@@ -1,4 +0,0 @@
-foo = [
- "1",
- "2", # comment
-]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/assign_colon.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/assign_colon.hcl
deleted file mode 100644
index eb5a99a69..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/assign_colon.hcl
+++ /dev/null
@@ -1,6 +0,0 @@
-resource = [{
- "foo": {
- "bar": {},
- "baz": [1, 2, "foo"],
- }
-}]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment.hcl
deleted file mode 100644
index 1ff7f29fd..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment.hcl
+++ /dev/null
@@ -1,15 +0,0 @@
-// Foo
-
-/* Bar */
-
-/*
-/*
-Baz
-*/
-
-# Another
-
-# Multiple
-# Lines
-
-foo = "bar"
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment_single.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment_single.hcl
deleted file mode 100644
index fec56017d..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/comment_single.hcl
+++ /dev/null
@@ -1 +0,0 @@
-# Hello
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex.hcl
deleted file mode 100644
index cccb5b06f..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex.hcl
+++ /dev/null
@@ -1,42 +0,0 @@
-// This comes from Terraform, as a test
-variable "foo" {
- default = "bar"
- description = "bar"
-}
-
-provider "aws" {
- access_key = "foo"
- secret_key = "bar"
-}
-
-provider "do" {
- api_key = "${var.foo}"
-}
-
-resource "aws_security_group" "firewall" {
- count = 5
-}
-
-resource aws_instance "web" {
- ami = "${var.foo}"
- security_groups = [
- "foo",
- "${aws_security_group.firewall.foo}"
- ]
-
- network_interface {
- device_index = 0
- description = "Main network interface"
- }
-}
-
-resource "aws_instance" "db" {
- security_groups = "${aws_security_group.firewall.*.id}"
- VPC = "foo"
-
- depends_on = ["aws_instance.web"]
-}
-
-output "web_ip" {
- value = "${aws_instance.web.private_ip}"
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex_key.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex_key.hcl
deleted file mode 100644
index 0007aaf5f..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/complex_key.hcl
+++ /dev/null
@@ -1 +0,0 @@
-foo.bar = "baz"
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/empty.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/empty.hcl
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/empty.hcl
+++ /dev/null
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list.hcl
deleted file mode 100644
index 059d4ce65..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list.hcl
+++ /dev/null
@@ -1 +0,0 @@
-foo = [1, 2, "foo"]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list_comma.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list_comma.hcl
deleted file mode 100644
index 50f4218ac..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/list_comma.hcl
+++ /dev/null
@@ -1 +0,0 @@
-foo = [1, 2, "foo",]
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/multiple.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/multiple.hcl
deleted file mode 100644
index 029c54b0c..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/multiple.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-foo = "bar"
-key = 7
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/old.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/old.hcl
deleted file mode 100644
index e9f77cae9..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/old.hcl
+++ /dev/null
@@ -1,3 +0,0 @@
-default = {
- "eu-west-1": "ami-b1cf19c6",
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure.hcl
deleted file mode 100644
index 92592fbb3..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-// This is a test structure for the lexer
-foo bar "baz" {
- key = 7
- foo = "bar"
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_basic.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_basic.hcl
deleted file mode 100644
index 7229a1f01..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_basic.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-foo {
- value = 7
- "value" = 8
- "complex::value" = 9
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_empty.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_empty.hcl
deleted file mode 100644
index 4d156ddea..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/structure_empty.hcl
+++ /dev/null
@@ -1 +0,0 @@
-resource "foo" "bar" {}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/types.hcl b/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/types.hcl
deleted file mode 100644
index cf2747ea1..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/test-fixtures/types.hcl
+++ /dev/null
@@ -1,7 +0,0 @@
-foo = "bar"
-bar = 7
-baz = [1,2,3]
-foo = -12
-bar = 3.14159
-foo = true
-bar = false
diff --git a/vendor/github.com/hashicorp/hcl/hcl/token/token_test.go b/vendor/github.com/hashicorp/hcl/hcl/token/token_test.go
deleted file mode 100644
index e4b4af25b..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl/token/token_test.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package token
-
-import (
- "reflect"
- "testing"
-)
-
-func TestTypeString(t *testing.T) {
- var tokens = []struct {
- tt Type
- str string
- }{
- {ILLEGAL, "ILLEGAL"},
- {EOF, "EOF"},
- {COMMENT, "COMMENT"},
- {IDENT, "IDENT"},
- {NUMBER, "NUMBER"},
- {FLOAT, "FLOAT"},
- {BOOL, "BOOL"},
- {STRING, "STRING"},
- {HEREDOC, "HEREDOC"},
- {LBRACK, "LBRACK"},
- {LBRACE, "LBRACE"},
- {COMMA, "COMMA"},
- {PERIOD, "PERIOD"},
- {RBRACK, "RBRACK"},
- {RBRACE, "RBRACE"},
- {ASSIGN, "ASSIGN"},
- {ADD, "ADD"},
- {SUB, "SUB"},
- }
-
- for _, token := range tokens {
- if token.tt.String() != token.str {
- t.Errorf("want: %q got:%q\n", token.str, token.tt)
- }
- }
-
-}
-
-func TestTokenValue(t *testing.T) {
- var tokens = []struct {
- tt Token
- v interface{}
- }{
- {Token{Type: BOOL, Text: `true`}, true},
- {Token{Type: BOOL, Text: `false`}, false},
- {Token{Type: FLOAT, Text: `3.14`}, float64(3.14)},
- {Token{Type: NUMBER, Text: `42`}, int64(42)},
- {Token{Type: IDENT, Text: `foo`}, "foo"},
- {Token{Type: STRING, Text: `"foo"`}, "foo"},
- {Token{Type: STRING, Text: `"foo\nbar"`}, "foo\nbar"},
- {Token{Type: STRING, Text: `"${file("foo")}"`}, `${file("foo")}`},
- {
- Token{
- Type: STRING,
- Text: `"${replace("foo", ".", "\\.")}"`,
- },
- `${replace("foo", ".", "\\.")}`},
- {Token{Type: HEREDOC, Text: "<<EOF\nfoo\nbar\nEOF"}, "foo\nbar"},
- }
-
- for _, token := range tokens {
- if val := token.tt.Value(); !reflect.DeepEqual(val, token.v) {
- t.Errorf("want: %v got:%v\n", token.v, val)
- }
- }
-
-}
diff --git a/vendor/github.com/hashicorp/hcl/hcl_test.go b/vendor/github.com/hashicorp/hcl/hcl_test.go
deleted file mode 100644
index 31dff7c9e..000000000
--- a/vendor/github.com/hashicorp/hcl/hcl_test.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package hcl
-
-import (
- "io/ioutil"
- "path/filepath"
- "testing"
-)
-
-// This is the directory where our test fixtures are.
-const fixtureDir = "./test-fixtures"
-
-func testReadFile(t *testing.T, n string) string {
- d, err := ioutil.ReadFile(filepath.Join(fixtureDir, n))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- return string(d)
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/parser_test.go b/vendor/github.com/hashicorp/hcl/json/parser/parser_test.go
deleted file mode 100644
index e0cebf50a..000000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/parser_test.go
+++ /dev/null
@@ -1,384 +0,0 @@
-package parser
-
-import (
- "fmt"
- "io/ioutil"
- "path/filepath"
- "reflect"
- "runtime"
- "testing"
-
- "github.com/hashicorp/hcl/hcl/ast"
- "github.com/hashicorp/hcl/hcl/token"
-)
-
-func TestType(t *testing.T) {
- var literals = []struct {
- typ token.Type
- src string
- }{
- {token.STRING, `"foo": "bar"`},
- {token.NUMBER, `"foo": 123`},
- {token.FLOAT, `"foo": 123.12`},
- {token.FLOAT, `"foo": -123.12`},
- {token.BOOL, `"foo": true`},
- {token.STRING, `"foo": null`},
- }
-
- for _, l := range literals {
- t.Logf("Testing: %s", l.src)
-
- p := newParser([]byte(l.src))
- item, err := p.objectItem()
- if err != nil {
- t.Error(err)
- }
-
- lit, ok := item.Val.(*ast.LiteralType)
- if !ok {
- t.Errorf("node should be of type LiteralType, got: %T", item.Val)
- }
-
- if lit.Token.Type != l.typ {
- t.Errorf("want: %s, got: %s", l.typ, lit.Token.Type)
- }
- }
-}
-
-func TestListType(t *testing.T) {
- var literals = []struct {
- src string
- tokens []token.Type
- }{
- {
- `"foo": ["123", 123]`,
- []token.Type{token.STRING, token.NUMBER},
- },
- {
- `"foo": [123, "123",]`,
- []token.Type{token.NUMBER, token.STRING},
- },
- {
- `"foo": []`,
- []token.Type{},
- },
- {
- `"foo": ["123", 123]`,
- []token.Type{token.STRING, token.NUMBER},
- },
- {
- `"foo": ["123", {}]`,
- []token.Type{token.STRING, token.LBRACE},
- },
- }
-
- for _, l := range literals {
- t.Logf("Testing: %s", l.src)
-
- p := newParser([]byte(l.src))
- item, err := p.objectItem()
- if err != nil {
- t.Error(err)
- }
-
- list, ok := item.Val.(*ast.ListType)
- if !ok {
- t.Errorf("node should be of type LiteralType, got: %T", item.Val)
- }
-
- tokens := []token.Type{}
- for _, li := range list.List {
- switch v := li.(type) {
- case *ast.LiteralType:
- tokens = append(tokens, v.Token.Type)
- case *ast.ObjectType:
- tokens = append(tokens, token.LBRACE)
- }
- }
-
- equals(t, l.tokens, tokens)
- }
-}
-
-func TestObjectType(t *testing.T) {
- var literals = []struct {
- src string
- nodeType []ast.Node
- itemLen int
- }{
- {
- `"foo": {}`,
- nil,
- 0,
- },
- {
- `"foo": {
- "bar": "fatih"
- }`,
- []ast.Node{&ast.LiteralType{}},
- 1,
- },
- {
- `"foo": {
- "bar": "fatih",
- "baz": ["arslan"]
- }`,
- []ast.Node{
- &ast.LiteralType{},
- &ast.ListType{},
- },
- 2,
- },
- {
- `"foo": {
- "bar": {}
- }`,
- []ast.Node{
- &ast.ObjectType{},
- },
- 1,
- },
- {
- `"foo": {
- "bar": {},
- "foo": true
- }`,
- []ast.Node{
- &ast.ObjectType{},
- &ast.LiteralType{},
- },
- 2,
- },
- }
-
- for _, l := range literals {
- t.Logf("Testing:\n%s\n", l.src)
-
- p := newParser([]byte(l.src))
- // p.enableTrace = true
- item, err := p.objectItem()
- if err != nil {
- t.Error(err)
- }
-
- // we know that the ObjectKey name is foo for all cases, what matters
- // is the object
- obj, ok := item.Val.(*ast.ObjectType)
- if !ok {
- t.Errorf("node should be of type LiteralType, got: %T", item.Val)
- }
-
- // check if the total length of items are correct
- equals(t, l.itemLen, len(obj.List.Items))
-
- // check if the types are correct
- for i, item := range obj.List.Items {
- equals(t, reflect.TypeOf(l.nodeType[i]), reflect.TypeOf(item.Val))
- }
- }
-}
-
-func TestFlattenObjects(t *testing.T) {
- var literals = []struct {
- src string
- nodeType []ast.Node
- itemLen int
- }{
- {
- `{
- "foo": [
- {
- "foo": "svh",
- "bar": "fatih"
- }
- ]
- }`,
- []ast.Node{
- &ast.ObjectType{},
- &ast.LiteralType{},
- &ast.LiteralType{},
- },
- 3,
- },
- {
- `{
- "variable": {
- "foo": {}
- }
- }`,
- []ast.Node{
- &ast.ObjectType{},
- },
- 1,
- },
- {
- `{
- "empty": []
- }`,
- []ast.Node{
- &ast.ListType{},
- },
- 1,
- },
- {
- `{
- "basic": [1, 2, 3]
- }`,
- []ast.Node{
- &ast.ListType{},
- },
- 1,
- },
- }
-
- for _, l := range literals {
- t.Logf("Testing:\n%s\n", l.src)
-
- f, err := Parse([]byte(l.src))
- if err != nil {
- t.Error(err)
- }
-
- // the first object is always an ObjectList so just assert that one
- // so we can use it as such
- obj, ok := f.Node.(*ast.ObjectList)
- if !ok {
- t.Errorf("node should be *ast.ObjectList, got: %T", f.Node)
- }
-
- // check if the types are correct
- var i int
- for _, item := range obj.Items {
- equals(t, reflect.TypeOf(l.nodeType[i]), reflect.TypeOf(item.Val))
- i++
-
- if obj, ok := item.Val.(*ast.ObjectType); ok {
- for _, item := range obj.List.Items {
- equals(t, reflect.TypeOf(l.nodeType[i]), reflect.TypeOf(item.Val))
- i++
- }
- }
- }
-
- // check if the number of items is correct
- equals(t, l.itemLen, i)
-
- }
-}
-
-func TestObjectKey(t *testing.T) {
- keys := []struct {
- exp []token.Type
- src string
- }{
- {[]token.Type{token.STRING}, `"foo": {}`},
- }
-
- for _, k := range keys {
- p := newParser([]byte(k.src))
- keys, err := p.objectKey()
- if err != nil {
- t.Fatal(err)
- }
-
- tokens := []token.Type{}
- for _, o := range keys {
- tokens = append(tokens, o.Token.Type)
- }
-
- equals(t, k.exp, tokens)
- }
-
- errKeys := []struct {
- src string
- }{
- {`foo 12 {}`},
- {`foo bar = {}`},
- {`foo []`},
- {`12 {}`},
- }
-
- for _, k := range errKeys {
- p := newParser([]byte(k.src))
- _, err := p.objectKey()
- if err == nil {
- t.Errorf("case '%s' should give an error", k.src)
- }
- }
-}
-
-// Official HCL tests
-func TestParse(t *testing.T) {
- cases := []struct {
- Name string
- Err bool
- }{
- {
- "array.json",
- false,
- },
- {
- "basic.json",
- false,
- },
- {
- "object.json",
- false,
- },
- {
- "types.json",
- false,
- },
- {
- "bad_input_128.json",
- true,
- },
- {
- "bad_input_tf_8110.json",
- true,
- },
- {
- "good_input_tf_8110.json",
- false,
- },
- }
-
- const fixtureDir = "./test-fixtures"
-
- for _, tc := range cases {
- d, err := ioutil.ReadFile(filepath.Join(fixtureDir, tc.Name))
- if err != nil {
- t.Fatalf("err: %s", err)
- }
-
- _, err = Parse(d)
- if (err != nil) != tc.Err {
- t.Fatalf("Input: %s\n\nError: %s", tc.Name, err)
- }
- }
-}
-
-func TestParse_inline(t *testing.T) {
- cases := []struct {
- Value string
- Err bool
- }{
- {"{:{", true},
- }
-
- for _, tc := range cases {
- _, err := Parse([]byte(tc.Value))
- if (err != nil) != tc.Err {
- t.Fatalf("Input: %q\n\nError: %s", tc.Value, err)
- }
- }
-}
-
-// equals fails the test if exp is not equal to act.
-func equals(tb testing.TB, exp, act interface{}) {
- if !reflect.DeepEqual(exp, act) {
- _, file, line, _ := runtime.Caller(1)
- fmt.Printf("\033[31m%s:%d:\n\n\texp: %s\n\n\tgot: %s\033[39m\n\n", filepath.Base(file), line, exp, act)
- tb.FailNow()
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/array.json b/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/array.json
deleted file mode 100644
index e320f17ab..000000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/array.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "foo": [1, 2, "bar"],
- "bar": "baz"
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_128.json b/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_128.json
deleted file mode 100644
index b5f850c96..000000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_128.json
+++ /dev/null
@@ -1 +0,0 @@
-{:{
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_tf_8110.json b/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_tf_8110.json
deleted file mode 100644
index a04385833..000000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/bad_input_tf_8110.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "variable": {
- "poc": {
- "default": "${replace("europe-west", "-", " ")}"
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/basic.json b/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/basic.json
deleted file mode 100644
index b54bde96c..000000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/basic.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "foo": "bar"
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/good_input_tf_8110.json b/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/good_input_tf_8110.json
deleted file mode 100644
index f21aa090d..000000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/good_input_tf_8110.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "variable": {
- "poc": {
- "default": "${replace(\"europe-west\", \"-\", \" \")}"
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/object.json b/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/object.json
deleted file mode 100644
index 72168a3cc..000000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/object.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "foo": {
- "bar": [1,2]
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/types.json b/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/types.json
deleted file mode 100644
index 9a142a6ca..000000000
--- a/vendor/github.com/hashicorp/hcl/json/parser/test-fixtures/types.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "foo": "bar",
- "bar": 7,
- "baz": [1,2,3],
- "foo": -12,
- "bar": 3.14159,
- "foo": true,
- "bar": false,
- "foo": null
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/scanner/scanner_test.go b/vendor/github.com/hashicorp/hcl/json/scanner/scanner_test.go
deleted file mode 100644
index 3033a5797..000000000
--- a/vendor/github.com/hashicorp/hcl/json/scanner/scanner_test.go
+++ /dev/null
@@ -1,362 +0,0 @@
-package scanner
-
-import (
- "bytes"
- "fmt"
- "testing"
-
- "github.com/hashicorp/hcl/json/token"
-)
-
-var f100 = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
-
-type tokenPair struct {
- tok token.Type
- text string
-}
-
-var tokenLists = map[string][]tokenPair{
- "operator": []tokenPair{
- {token.LBRACK, "["},
- {token.LBRACE, "{"},
- {token.COMMA, ","},
- {token.PERIOD, "."},
- {token.RBRACK, "]"},
- {token.RBRACE, "}"},
- },
- "bool": []tokenPair{
- {token.BOOL, "true"},
- {token.BOOL, "false"},
- },
- "string": []tokenPair{
- {token.STRING, `" "`},
- {token.STRING, `"a"`},
- {token.STRING, `"本"`},
- {token.STRING, `"${file(\"foo\")}"`},
- {token.STRING, `"\a"`},
- {token.STRING, `"\b"`},
- {token.STRING, `"\f"`},
- {token.STRING, `"\n"`},
- {token.STRING, `"\r"`},
- {token.STRING, `"\t"`},
- {token.STRING, `"\v"`},
- {token.STRING, `"\""`},
- {token.STRING, `"\000"`},
- {token.STRING, `"\777"`},
- {token.STRING, `"\x00"`},
- {token.STRING, `"\xff"`},
- {token.STRING, `"\u0000"`},
- {token.STRING, `"\ufA16"`},
- {token.STRING, `"\U00000000"`},
- {token.STRING, `"\U0000ffAB"`},
- {token.STRING, `"` + f100 + `"`},
- },
- "number": []tokenPair{
- {token.NUMBER, "0"},
- {token.NUMBER, "1"},
- {token.NUMBER, "9"},
- {token.NUMBER, "42"},
- {token.NUMBER, "1234567890"},
- {token.NUMBER, "-0"},
- {token.NUMBER, "-1"},
- {token.NUMBER, "-9"},
- {token.NUMBER, "-42"},
- {token.NUMBER, "-1234567890"},
- },
- "float": []tokenPair{
- {token.FLOAT, "0."},
- {token.FLOAT, "1."},
- {token.FLOAT, "42."},
- {token.FLOAT, "01234567890."},
- {token.FLOAT, ".0"},
- {token.FLOAT, ".1"},
- {token.FLOAT, ".42"},
- {token.FLOAT, ".0123456789"},
- {token.FLOAT, "0.0"},
- {token.FLOAT, "1.0"},
- {token.FLOAT, "42.0"},
- {token.FLOAT, "01234567890.0"},
- {token.FLOAT, "0e0"},
- {token.FLOAT, "1e0"},
- {token.FLOAT, "42e0"},
- {token.FLOAT, "01234567890e0"},
- {token.FLOAT, "0E0"},
- {token.FLOAT, "1E0"},
- {token.FLOAT, "42E0"},
- {token.FLOAT, "01234567890E0"},
- {token.FLOAT, "0e+10"},
- {token.FLOAT, "1e-10"},
- {token.FLOAT, "42e+10"},
- {token.FLOAT, "01234567890e-10"},
- {token.FLOAT, "0E+10"},
- {token.FLOAT, "1E-10"},
- {token.FLOAT, "42E+10"},
- {token.FLOAT, "01234567890E-10"},
- {token.FLOAT, "01.8e0"},
- {token.FLOAT, "1.4e0"},
- {token.FLOAT, "42.2e0"},
- {token.FLOAT, "01234567890.12e0"},
- {token.FLOAT, "0.E0"},
- {token.FLOAT, "1.12E0"},
- {token.FLOAT, "42.123E0"},
- {token.FLOAT, "01234567890.213E0"},
- {token.FLOAT, "0.2e+10"},
- {token.FLOAT, "1.2e-10"},
- {token.FLOAT, "42.54e+10"},
- {token.FLOAT, "01234567890.98e-10"},
- {token.FLOAT, "0.1E+10"},
- {token.FLOAT, "1.1E-10"},
- {token.FLOAT, "42.1E+10"},
- {token.FLOAT, "01234567890.1E-10"},
- {token.FLOAT, "-0.0"},
- {token.FLOAT, "-1.0"},
- {token.FLOAT, "-42.0"},
- {token.FLOAT, "-01234567890.0"},
- {token.FLOAT, "-0e0"},
- {token.FLOAT, "-1e0"},
- {token.FLOAT, "-42e0"},
- {token.FLOAT, "-01234567890e0"},
- {token.FLOAT, "-0E0"},
- {token.FLOAT, "-1E0"},
- {token.FLOAT, "-42E0"},
- {token.FLOAT, "-01234567890E0"},
- {token.FLOAT, "-0e+10"},
- {token.FLOAT, "-1e-10"},
- {token.FLOAT, "-42e+10"},
- {token.FLOAT, "-01234567890e-10"},
- {token.FLOAT, "-0E+10"},
- {token.FLOAT, "-1E-10"},
- {token.FLOAT, "-42E+10"},
- {token.FLOAT, "-01234567890E-10"},
- {token.FLOAT, "-01.8e0"},
- {token.FLOAT, "-1.4e0"},
- {token.FLOAT, "-42.2e0"},
- {token.FLOAT, "-01234567890.12e0"},
- {token.FLOAT, "-0.E0"},
- {token.FLOAT, "-1.12E0"},
- {token.FLOAT, "-42.123E0"},
- {token.FLOAT, "-01234567890.213E0"},
- {token.FLOAT, "-0.2e+10"},
- {token.FLOAT, "-1.2e-10"},
- {token.FLOAT, "-42.54e+10"},
- {token.FLOAT, "-01234567890.98e-10"},
- {token.FLOAT, "-0.1E+10"},
- {token.FLOAT, "-1.1E-10"},
- {token.FLOAT, "-42.1E+10"},
- {token.FLOAT, "-01234567890.1E-10"},
- },
-}
-
-var orderedTokenLists = []string{
- "comment",
- "operator",
- "bool",
- "string",
- "number",
- "float",
-}
-
-func TestPosition(t *testing.T) {
- // create artifical source code
- buf := new(bytes.Buffer)
-
- for _, listName := range orderedTokenLists {
- for _, ident := range tokenLists[listName] {
- fmt.Fprintf(buf, "\t\t\t\t%s\n", ident.text)
- }
- }
-
- s := New(buf.Bytes())
-
- pos := token.Pos{"", 4, 1, 5}
- s.Scan()
- for _, listName := range orderedTokenLists {
-
- for _, k := range tokenLists[listName] {
- curPos := s.tokPos
- // fmt.Printf("[%q] s = %+v:%+v\n", k.text, curPos.Offset, curPos.Column)
-
- if curPos.Offset != pos.Offset {
- t.Fatalf("offset = %d, want %d for %q", curPos.Offset, pos.Offset, k.text)
- }
- if curPos.Line != pos.Line {
- t.Fatalf("line = %d, want %d for %q", curPos.Line, pos.Line, k.text)
- }
- if curPos.Column != pos.Column {
- t.Fatalf("column = %d, want %d for %q", curPos.Column, pos.Column, k.text)
- }
- pos.Offset += 4 + len(k.text) + 1 // 4 tabs + token bytes + newline
- pos.Line += countNewlines(k.text) + 1 // each token is on a new line
-
- s.Error = func(pos token.Pos, msg string) {
- t.Errorf("error %q for %q", msg, k.text)
- }
-
- s.Scan()
- }
- }
- // make sure there were no token-internal errors reported by scanner
- if s.ErrorCount != 0 {
- t.Errorf("%d errors", s.ErrorCount)
- }
-}
-
-func TestComment(t *testing.T) {
- testTokenList(t, tokenLists["comment"])
-}
-
-func TestOperator(t *testing.T) {
- testTokenList(t, tokenLists["operator"])
-}
-
-func TestBool(t *testing.T) {
- testTokenList(t, tokenLists["bool"])
-}
-
-func TestIdent(t *testing.T) {
- testTokenList(t, tokenLists["ident"])
-}
-
-func TestString(t *testing.T) {
- testTokenList(t, tokenLists["string"])
-}
-
-func TestNumber(t *testing.T) {
- testTokenList(t, tokenLists["number"])
-}
-
-func TestFloat(t *testing.T) {
- testTokenList(t, tokenLists["float"])
-}
-
-func TestRealExample(t *testing.T) {
- complexReal := `
-{
- "variable": {
- "foo": {
- "default": "bar",
- "description": "bar",
- "depends_on": ["something"]
- }
- }
-}`
-
- literals := []struct {
- tokenType token.Type
- literal string
- }{
- {token.LBRACE, `{`},
- {token.STRING, `"variable"`},
- {token.COLON, `:`},
- {token.LBRACE, `{`},
- {token.STRING, `"foo"`},
- {token.COLON, `:`},
- {token.LBRACE, `{`},
- {token.STRING, `"default"`},
- {token.COLON, `:`},
- {token.STRING, `"bar"`},
- {token.COMMA, `,`},
- {token.STRING, `"description"`},
- {token.COLON, `:`},
- {token.STRING, `"bar"`},
- {token.COMMA, `,`},
- {token.STRING, `"depends_on"`},
- {token.COLON, `:`},
- {token.LBRACK, `[`},
- {token.STRING, `"something"`},
- {token.RBRACK, `]`},
- {token.RBRACE, `}`},
- {token.RBRACE, `}`},
- {token.RBRACE, `}`},
- {token.EOF, ``},
- }
-
- s := New([]byte(complexReal))
- for _, l := range literals {
- tok := s.Scan()
- if l.tokenType != tok.Type {
- t.Errorf("got: %s want %s for %s\n", tok, l.tokenType, tok.String())
- }
-
- if l.literal != tok.Text {
- t.Errorf("got: %s want %s\n", tok, l.literal)
- }
- }
-
-}
-
-func TestError(t *testing.T) {
- testError(t, "\x80", "1:1", "illegal UTF-8 encoding", token.ILLEGAL)
- testError(t, "\xff", "1:1", "illegal UTF-8 encoding", token.ILLEGAL)
-
- testError(t, `"ab`+"\x80", "1:4", "illegal UTF-8 encoding", token.STRING)
- testError(t, `"abc`+"\xff", "1:5", "illegal UTF-8 encoding", token.STRING)
-
- testError(t, `01238`, "1:7", "numbers cannot start with 0", token.NUMBER)
- testError(t, `01238123`, "1:10", "numbers cannot start with 0", token.NUMBER)
- testError(t, `'aa'`, "1:1", "illegal char: '", token.ILLEGAL)
-
- testError(t, `"`, "1:2", "literal not terminated", token.STRING)
- testError(t, `"abc`, "1:5", "literal not terminated", token.STRING)
- testError(t, `"abc`+"\n", "1:5", "literal not terminated", token.STRING)
-}
-
-func testError(t *testing.T, src, pos, msg string, tok token.Type) {
- s := New([]byte(src))
-
- errorCalled := false
- s.Error = func(p token.Pos, m string) {
- if !errorCalled {
- if pos != p.String() {
- t.Errorf("pos = %q, want %q for %q", p, pos, src)
- }
-
- if m != msg {
- t.Errorf("msg = %q, want %q for %q", m, msg, src)
- }
- errorCalled = true
- }
- }
-
- tk := s.Scan()
- if tk.Type != tok {
- t.Errorf("tok = %s, want %s for %q", tk, tok, src)
- }
- if !errorCalled {
- t.Errorf("error handler not called for %q", src)
- }
- if s.ErrorCount == 0 {
- t.Errorf("count = %d, want > 0 for %q", s.ErrorCount, src)
- }
-}
-
-func testTokenList(t *testing.T, tokenList []tokenPair) {
- // create artifical source code
- buf := new(bytes.Buffer)
- for _, ident := range tokenList {
- fmt.Fprintf(buf, "%s\n", ident.text)
- }
-
- s := New(buf.Bytes())
- for _, ident := range tokenList {
- tok := s.Scan()
- if tok.Type != ident.tok {
- t.Errorf("tok = %q want %q for %q\n", tok, ident.tok, ident.text)
- }
-
- if tok.Text != ident.text {
- t.Errorf("text = %q want %q", tok.String(), ident.text)
- }
-
- }
-}
-
-func countNewlines(s string) int {
- n := 0
- for _, ch := range s {
- if ch == '\n' {
- n++
- }
- }
- return n
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/test-fixtures/array.json b/vendor/github.com/hashicorp/hcl/json/test-fixtures/array.json
deleted file mode 100644
index e320f17ab..000000000
--- a/vendor/github.com/hashicorp/hcl/json/test-fixtures/array.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "foo": [1, 2, "bar"],
- "bar": "baz"
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/test-fixtures/basic.json b/vendor/github.com/hashicorp/hcl/json/test-fixtures/basic.json
deleted file mode 100644
index b54bde96c..000000000
--- a/vendor/github.com/hashicorp/hcl/json/test-fixtures/basic.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "foo": "bar"
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/test-fixtures/object.json b/vendor/github.com/hashicorp/hcl/json/test-fixtures/object.json
deleted file mode 100644
index 72168a3cc..000000000
--- a/vendor/github.com/hashicorp/hcl/json/test-fixtures/object.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "foo": {
- "bar": [1,2]
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/test-fixtures/types.json b/vendor/github.com/hashicorp/hcl/json/test-fixtures/types.json
deleted file mode 100644
index 9a142a6ca..000000000
--- a/vendor/github.com/hashicorp/hcl/json/test-fixtures/types.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "foo": "bar",
- "bar": 7,
- "baz": [1,2,3],
- "foo": -12,
- "bar": 3.14159,
- "foo": true,
- "bar": false,
- "foo": null
-}
diff --git a/vendor/github.com/hashicorp/hcl/json/token/token_test.go b/vendor/github.com/hashicorp/hcl/json/token/token_test.go
deleted file mode 100644
index a83fdd55b..000000000
--- a/vendor/github.com/hashicorp/hcl/json/token/token_test.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package token
-
-import (
- "testing"
-)
-
-func TestTypeString(t *testing.T) {
- var tokens = []struct {
- tt Type
- str string
- }{
- {ILLEGAL, "ILLEGAL"},
- {EOF, "EOF"},
- {NUMBER, "NUMBER"},
- {FLOAT, "FLOAT"},
- {BOOL, "BOOL"},
- {STRING, "STRING"},
- {NULL, "NULL"},
- {LBRACK, "LBRACK"},
- {LBRACE, "LBRACE"},
- {COMMA, "COMMA"},
- {PERIOD, "PERIOD"},
- {RBRACK, "RBRACK"},
- {RBRACE, "RBRACE"},
- }
-
- for _, token := range tokens {
- if token.tt.String() != token.str {
- t.Errorf("want: %q got:%q\n", token.str, token.tt)
-
- }
- }
-
-}
diff --git a/vendor/github.com/hashicorp/hcl/lex_test.go b/vendor/github.com/hashicorp/hcl/lex_test.go
deleted file mode 100644
index 806276444..000000000
--- a/vendor/github.com/hashicorp/hcl/lex_test.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package hcl
-
-import (
- "testing"
-)
-
-func TestLexMode(t *testing.T) {
- cases := []struct {
- Input string
- Mode lexModeValue
- }{
- {
- "",
- lexModeHcl,
- },
- {
- "foo",
- lexModeHcl,
- },
- {
- "{}",
- lexModeJson,
- },
- {
- " {}",
- lexModeJson,
- },
- }
-
- for i, tc := range cases {
- actual := lexMode([]byte(tc.Input))
-
- if actual != tc.Mode {
- t.Fatalf("%d: %#v", i, actual)
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/assign_deep.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/assign_deep.hcl
deleted file mode 100644
index dd3151cb7..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/assign_deep.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-resource = [{
- foo = [{
- bar = {}
- }]
-}]
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/basic.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/basic.hcl
deleted file mode 100644
index 949994487..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/basic.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-foo = "bar"
-bar = "${file("bing/bong.txt")}"
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/basic.json b/vendor/github.com/hashicorp/hcl/test-fixtures/basic.json
deleted file mode 100644
index 7bdddc84b..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/basic.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "foo": "bar",
- "bar": "${file(\"bing/bong.txt\")}"
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/basic_int_string.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/basic_int_string.hcl
deleted file mode 100644
index 4e415da20..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/basic_int_string.hcl
+++ /dev/null
@@ -1 +0,0 @@
-count = "3"
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/basic_squish.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/basic_squish.hcl
deleted file mode 100644
index 363697b49..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/basic_squish.hcl
+++ /dev/null
@@ -1,3 +0,0 @@
-foo="bar"
-bar="${file("bing/bong.txt")}"
-foo-bar="baz"
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/block_assign.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/block_assign.hcl
deleted file mode 100644
index ee8b06fe3..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/block_assign.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-environment = "aws" {
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.hcl
deleted file mode 100644
index 5b185cc91..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.hcl
+++ /dev/null
@@ -1,15 +0,0 @@
-key "" {
- policy = "read"
-}
-
-key "foo/" {
- policy = "write"
-}
-
-key "foo/bar/" {
- policy = "read"
-}
-
-key "foo/bar/baz" {
- policy = "deny"
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.json b/vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.json
deleted file mode 100644
index 151864ee8..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_policy.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "key": {
- "": {
- "policy": "read"
- },
-
- "foo/": {
- "policy": "write"
- },
-
- "foo/bar/": {
- "policy": "read"
- },
-
- "foo/bar/baz": {
- "policy": "deny"
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.hcl
deleted file mode 100644
index 52dcaa1bc..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.hcl
+++ /dev/null
@@ -1,10 +0,0 @@
-variable "foo" {
- default = "bar"
- description = "bar"
-}
-
-variable "amis" {
- default = {
- east = "foo"
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.json b/vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.json
deleted file mode 100644
index 49f921ed0..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "variable": {
- "foo": {
- "default": "bar",
- "description": "bar"
- },
-
- "amis": {
- "default": {
- "east": "foo"
- }
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/empty.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/empty.hcl
deleted file mode 100644
index 5be1b2315..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/empty.hcl
+++ /dev/null
@@ -1 +0,0 @@
-resource "foo" {}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/escape.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/escape.hcl
deleted file mode 100644
index f818b15e0..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/escape.hcl
+++ /dev/null
@@ -1,6 +0,0 @@
-foo = "bar\"baz\\n"
-bar = "new\nline"
-qux = "back\\slash"
-qax = "slash\\:colon"
-nested = "${HH\\:mm\\:ss}"
-nestedquotes = "${"\"stringwrappedinquotes\""}"
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/escape_backslash.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/escape_backslash.hcl
deleted file mode 100644
index bc337fb7c..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/escape_backslash.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-output {
- one = "${replace(var.sub_domain, ".", "\\.")}"
- two = "${replace(var.sub_domain, ".", "\\\\.")}"
- many = "${replace(var.sub_domain, ".", "\\\\\\\\.")}"
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/flat.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/flat.hcl
deleted file mode 100644
index 9bca551f8..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/flat.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-foo = "bar"
-Key = 7
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/float.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/float.hcl
deleted file mode 100644
index edf355e38..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/float.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-a = 1.02
-b = 2
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/float.json b/vendor/github.com/hashicorp/hcl/test-fixtures/float.json
deleted file mode 100644
index 580868043..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/float.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "a": 1.02,
- "b": 2
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/git_crypt.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/git_crypt.hcl
deleted file mode 100644
index f691948e1..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/git_crypt.hcl
+++ /dev/null
Binary files differ
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/interpolate.json b/vendor/github.com/hashicorp/hcl/test-fixtures/interpolate.json
deleted file mode 100644
index cad015198..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/interpolate.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "default": "${replace(\"europe-west\", \"-\", \" \")}"
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/list_of_lists.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/list_of_lists.hcl
deleted file mode 100644
index 8af345849..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/list_of_lists.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-foo = [["foo"], ["bar"]]
-
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/list_of_maps.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/list_of_maps.hcl
deleted file mode 100644
index 985a33bae..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/list_of_maps.hcl
+++ /dev/null
@@ -1,4 +0,0 @@
-foo = [
- {somekey1 = "someval1"},
- {somekey2 = "someval2", someextrakey = "someextraval"},
-]
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/multiline.hcl
deleted file mode 100644
index f883bd707..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline.hcl
+++ /dev/null
@@ -1,4 +0,0 @@
-foo = <<EOF
-bar
-baz
-EOF
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline.json b/vendor/github.com/hashicorp/hcl/test-fixtures/multiline.json
deleted file mode 100644
index 93f7cc55c..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "foo": "bar\nbaz"
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_bad.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_bad.hcl
deleted file mode 100644
index 4cd0f4dd7..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_bad.hcl
+++ /dev/null
@@ -1,4 +0,0 @@
-foo = <EOF
-bar
-baz
-EOF
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_indented.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_indented.hcl
deleted file mode 100644
index f1d7a843d..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_indented.hcl
+++ /dev/null
@@ -1,4 +0,0 @@
-foo = <<-EOF
- bar
- baz
- EOF
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_literal.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_literal.hcl
deleted file mode 100644
index f89fdfc71..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_literal.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-multiline_literal = "hello
- world" \ No newline at end of file
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_literal_with_hil.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_literal_with_hil.hcl
deleted file mode 100644
index b55a361ca..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_literal_with_hil.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-multiline_literal_with_hil = "${hello
- world}" \ No newline at end of file
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_no_eof.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_no_eof.hcl
deleted file mode 100644
index faa13290b..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_no_eof.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-foo = <<EOF
-bar
-baz
-EOF
-key = "value"
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_no_hanging_indent.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_no_hanging_indent.hcl
deleted file mode 100644
index c4331eeae..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_no_hanging_indent.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-foo = <<-EOF
- baz
- bar
- foo
- EOF
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_no_marker.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_no_marker.hcl
deleted file mode 100644
index 55c173966..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/multiline_no_marker.hcl
+++ /dev/null
@@ -1 +0,0 @@
-foo = <<
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/nested_block_comment.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/nested_block_comment.hcl
deleted file mode 100644
index e827782fe..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/nested_block_comment.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-/*
-foo = "bar/*"
-*/
-
-bar = "value"
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/nested_provider_bad.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/nested_provider_bad.hcl
deleted file mode 100644
index 94a753a5a..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/nested_provider_bad.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-resource "aws" "web" {
- provider = "aws" {
- region = "us-west-2"
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/null_strings.json b/vendor/github.com/hashicorp/hcl/test-fixtures/null_strings.json
deleted file mode 100644
index a5b8a5af2..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/null_strings.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "module": {
- "app": {
- "foo": null
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/object_list.json b/vendor/github.com/hashicorp/hcl/test-fixtures/object_list.json
deleted file mode 100644
index 73f367438..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/object_list.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "resource": {
- "aws_instance": {
- "db": {
- "vpc": "foo",
- "provisioner": [{
- "file": {
- "source": "foo",
- "destination": "bar"
- }
- }]
- }
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/object_with_bool.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/object_with_bool.hcl
deleted file mode 100644
index e565fb477..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/object_with_bool.hcl
+++ /dev/null
@@ -1,6 +0,0 @@
-path {
- policy = "write"
- permissions = {
- "bool" = [false]
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/scientific.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/scientific.hcl
deleted file mode 100644
index b9eca28dd..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/scientific.hcl
+++ /dev/null
@@ -1,6 +0,0 @@
-a = 1e-10
-b = 1e+10
-c = 1e10
-d = 1.2e-10
-e = 1.2e+10
-f = 1.2e10
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/scientific.json b/vendor/github.com/hashicorp/hcl/test-fixtures/scientific.json
deleted file mode 100644
index c1fce3c9d..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/scientific.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "a": 1e-10,
- "b": 1e+10,
- "c": 1e10,
- "d": 1.2e-10,
- "e": 1.2e+10,
- "f": 1.2e10
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/slice_expand.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/slice_expand.hcl
deleted file mode 100644
index 4d3725fc1..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/slice_expand.hcl
+++ /dev/null
@@ -1,7 +0,0 @@
-service "my-service-0" {
- key = "value"
-}
-
-service "my-service-1" {
- key = "value"
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/structure.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/structure.hcl
deleted file mode 100644
index 18b6b1e9f..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/structure.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-// This is a test structure for the lexer
-foo "baz" {
- key = 7
- foo = "bar"
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/structure.json b/vendor/github.com/hashicorp/hcl/test-fixtures/structure.json
deleted file mode 100644
index 30aa7654e..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/structure.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "foo": [{
- "baz": [{
- "key": 7,
- "foo": "bar"
- }]
- }]
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/structure2.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/structure2.hcl
deleted file mode 100644
index 7577ffc0e..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/structure2.hcl
+++ /dev/null
@@ -1,9 +0,0 @@
-// This is a test structure for the lexer
-foo "baz" {
- key = 7
- foo = "bar"
-}
-
-foo {
- key = 7
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/structure2.json b/vendor/github.com/hashicorp/hcl/test-fixtures/structure2.json
deleted file mode 100644
index c51fcf544..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/structure2.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "foo": [{
- "baz": {
- "key": 7,
- "foo": "bar"
- }
- }, {
- "key": 7
- }]
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_flat.json b/vendor/github.com/hashicorp/hcl/test-fixtures/structure_flat.json
deleted file mode 100644
index 5256db475..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_flat.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "foo": {
- "baz": {
- "key": 7,
- "foo": "bar"
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_flatmap.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/structure_flatmap.hcl
deleted file mode 100644
index fcf689e19..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_flatmap.hcl
+++ /dev/null
@@ -1,7 +0,0 @@
-foo {
- key = 7
-}
-
-foo {
- foo = "bar"
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_list.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/structure_list.hcl
deleted file mode 100644
index 33193ae53..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_list.hcl
+++ /dev/null
@@ -1,6 +0,0 @@
-foo {
- key = 7
-}
-foo {
- key = 12
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_list.json b/vendor/github.com/hashicorp/hcl/test-fixtures/structure_list.json
deleted file mode 100644
index 806a60e3e..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_list.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "foo": [{
- "key": 7
- }, {
- "key": 12
- }]
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_list_deep.json b/vendor/github.com/hashicorp/hcl/test-fixtures/structure_list_deep.json
deleted file mode 100644
index 46e98bef3..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_list_deep.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "bar": {
- "foo": {
- "name": "terraform_example",
- "ingress": [
- {
- "from_port": 22
- },
- {
- "from_port": 80
- }
- ]
- }
- }
-}
-
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_list_empty.json b/vendor/github.com/hashicorp/hcl/test-fixtures/structure_list_empty.json
deleted file mode 100644
index d99606fb1..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_list_empty.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "foo": []
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_multi.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/structure_multi.hcl
deleted file mode 100644
index e45b23d52..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_multi.hcl
+++ /dev/null
@@ -1,7 +0,0 @@
-foo "baz" {
- key = 7
-}
-
-foo "bar" {
- key = 12
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_multi.json b/vendor/github.com/hashicorp/hcl/test-fixtures/structure_multi.json
deleted file mode 100644
index 773761aca..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/structure_multi.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "foo": {
- "baz": {
- "key": 7
- },
-
- "bar": {
- "key": 12
- }
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.hcl
deleted file mode 100644
index fda9241a4..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.hcl
+++ /dev/null
@@ -1,5 +0,0 @@
-name = "terraform-test-app"
-
-config_vars {
- FOO = "bar"
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.json b/vendor/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.json
deleted file mode 100644
index e8c6fac3d..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "terraform-test-app",
- "config_vars": {
- "FOO": "bar"
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/terraform_variable_invalid.json b/vendor/github.com/hashicorp/hcl/test-fixtures/terraform_variable_invalid.json
deleted file mode 100644
index 081247ea4..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/terraform_variable_invalid.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "variable": {
- "whatever": "abc123"
- }
-}
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/tfvars.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/tfvars.hcl
deleted file mode 100644
index 5f623e04d..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/tfvars.hcl
+++ /dev/null
@@ -1,3 +0,0 @@
-regularvar = "Should work"
-map.key1 = "Value"
-map.key2 = "Other value"
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/unterminated_block_comment.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/unterminated_block_comment.hcl
deleted file mode 100644
index c0ce34d04..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/unterminated_block_comment.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-/*
-Foo
diff --git a/vendor/github.com/hashicorp/hcl/test-fixtures/unterminated_brace.hcl b/vendor/github.com/hashicorp/hcl/test-fixtures/unterminated_brace.hcl
deleted file mode 100644
index 31b37c4f9..000000000
--- a/vendor/github.com/hashicorp/hcl/test-fixtures/unterminated_brace.hcl
+++ /dev/null
@@ -1,2 +0,0 @@
-foo "baz" {
- bar = "baz"
diff --git a/vendor/github.com/hashicorp/hcl/testhelper/unix2dos.go b/vendor/github.com/hashicorp/hcl/testhelper/unix2dos.go
deleted file mode 100644
index 827ac6f1e..000000000
--- a/vendor/github.com/hashicorp/hcl/testhelper/unix2dos.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package testhelper
-
-import (
- "runtime"
- "strings"
-)
-
-// Converts the line endings when on Windows
-func Unix2dos(unix string) string {
- if runtime.GOOS != "windows" {
- return unix
- }
-
- return strings.Replace(unix, "\n", "\r\n", -1)
-}