diff --git a/pkg/server/completion_test.go b/pkg/server/completion_test.go index f4e5dc3..3aa9181 100644 --- a/pkg/server/completion_test.go +++ b/pkg/server/completion_test.go @@ -198,7 +198,7 @@ func TestCompletion(t *testing.T) { }, { name: "autocomplete through binary", - filename: "testdata/goto-basic-object.jsonnet", + filename: "testdata/basic-object.jsonnet", replaceString: "bar: 'foo',", replaceByString: "bar: self.", expected: protocol.CompletionList{ @@ -216,7 +216,7 @@ func TestCompletion(t *testing.T) { }, { name: "autocomplete locals", - filename: "testdata/goto-basic-object.jsonnet", + filename: "testdata/basic-object.jsonnet", replaceString: "bar: 'foo',", replaceByString: "bar: ", expected: protocol.CompletionList{ @@ -234,7 +234,7 @@ func TestCompletion(t *testing.T) { }, { name: "autocomplete locals: good prefix", - filename: "testdata/goto-basic-object.jsonnet", + filename: "testdata/basic-object.jsonnet", replaceString: "bar: 'foo',", replaceByString: "bar: some", expected: protocol.CompletionList{ @@ -252,7 +252,7 @@ func TestCompletion(t *testing.T) { }, { name: "autocomplete locals: bad prefix", - filename: "testdata/goto-basic-object.jsonnet", + filename: "testdata/basic-object.jsonnet", replaceString: "bar: 'foo',", replaceByString: "bar: bad", expected: protocol.CompletionList{ @@ -262,7 +262,7 @@ func TestCompletion(t *testing.T) { }, { name: "autocomplete through import", - filename: "testdata/goto-imported-file.jsonnet", + filename: "testdata/imported-file.jsonnet", replaceString: "b: otherfile.bar,", replaceByString: "b: otherfile.", expected: protocol.CompletionList{ @@ -291,7 +291,7 @@ func TestCompletion(t *testing.T) { }, { name: "autocomplete through import with prefix", - filename: "testdata/goto-imported-file.jsonnet", + filename: "testdata/imported-file.jsonnet", replaceString: "b: otherfile.bar,", replaceByString: "b: otherfile.b", expected: protocol.CompletionList{ @@ -311,7 +311,7 @@ func TestCompletion(t *testing.T) { }, { name: "autocomplete dollar sign", - filename: "testdata/goto-dollar-simple.jsonnet", + filename: "testdata/dollar-simple.jsonnet", replaceString: "test: $.attribute,", replaceByString: "test: $.", expected: protocol.CompletionList{ @@ -340,7 +340,7 @@ func TestCompletion(t *testing.T) { }, { name: "autocomplete dollar sign, end with comma", - filename: "testdata/goto-dollar-simple.jsonnet", + filename: "testdata/dollar-simple.jsonnet", replaceString: "test: $.attribute,", replaceByString: "test: $.,", expected: protocol.CompletionList{ @@ -369,7 +369,7 @@ func TestCompletion(t *testing.T) { }, { name: "autocomplete nested imported file", - filename: "testdata/goto-nested-imported-file.jsonnet", + filename: "testdata/nested-imported-file.jsonnet", replaceString: "foo: file.foo,", replaceByString: "foo: file.", expected: protocol.CompletionList{ @@ -398,7 +398,7 @@ func TestCompletion(t *testing.T) { }, { name: "autocomplete multiple fields within local", - filename: "testdata/goto-indexes.jsonnet", + filename: "testdata/indexes.jsonnet", replaceString: "attr: obj.foo", replaceByString: "attr: obj.", expected: protocol.CompletionList{ @@ -665,7 +665,7 @@ func TestCompletion(t *testing.T) { }, { name: "complete attribute from function", - filename: "testdata/goto-functions.libsonnet", + filename: "testdata/functions.libsonnet", replaceString: "test: myfunc(arg1, arg2)", replaceByString: "test: myfunc(arg1, arg2).", expected: protocol.CompletionList{ diff --git a/pkg/server/definition_test.go b/pkg/server/definition_test.go index 724ef78..5e5b283 100644 --- a/pkg/server/definition_test.go +++ b/pkg/server/definition_test.go @@ -165,7 +165,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "test goto local obj field from 'self.attr' from other obj", - filename: "./testdata/goto-indexes.jsonnet", + filename: "./testdata/indexes.jsonnet", position: protocol.Position{Line: 9, Character: 16}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -180,7 +180,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "test goto local object 'obj' via obj index 'obj.foo'", - filename: "./testdata/goto-indexes.jsonnet", + filename: "./testdata/indexes.jsonnet", position: protocol.Position{Line: 8, Character: 13}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -195,10 +195,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "test goto imported file", - filename: "./testdata/goto-imported-file.jsonnet", + filename: "./testdata/imported-file.jsonnet", position: protocol.Position{Line: 0, Character: 22}, results: []definitionResult{{ - targetFilename: "testdata/goto-basic-object.jsonnet", + targetFilename: "testdata/basic-object.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 0, Character: 0}, End: protocol.Position{Line: 0, Character: 0}, @@ -211,10 +211,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "test goto imported file at lhs index", - filename: "./testdata/goto-imported-file.jsonnet", + filename: "./testdata/imported-file.jsonnet", position: protocol.Position{Line: 3, Character: 16}, results: []definitionResult{{ - targetFilename: "testdata/goto-basic-object.jsonnet", + targetFilename: "testdata/basic-object.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 3, Character: 2}, End: protocol.Position{Line: 3, Character: 12}, @@ -227,10 +227,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "test goto imported file at rhs index", - filename: "./testdata/goto-imported-file.jsonnet", + filename: "./testdata/imported-file.jsonnet", position: protocol.Position{Line: 4, Character: 16}, results: []definitionResult{{ - targetFilename: "testdata/goto-basic-object.jsonnet", + targetFilename: "testdata/basic-object.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 5, Character: 2}, End: protocol.Position{Line: 5, Character: 12}, @@ -243,10 +243,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto import index", - filename: "testdata/goto-import-attribute.jsonnet", - position: protocol.Position{Line: 0, Character: 48}, + filename: "testdata/import-attribute.jsonnet", + position: protocol.Position{Line: 0, Character: 43}, results: []definitionResult{{ - targetFilename: "testdata/goto-basic-object.jsonnet", + targetFilename: "testdata/basic-object.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 5, Character: 2}, End: protocol.Position{Line: 5, Character: 12}, @@ -259,10 +259,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto attribute of nested import", - filename: "testdata/goto-nested-imported-file.jsonnet", + filename: "testdata/nested-imported-file.jsonnet", position: protocol.Position{Line: 2, Character: 13}, results: []definitionResult{{ - targetFilename: "testdata/goto-basic-object.jsonnet", + targetFilename: "testdata/basic-object.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 3, Character: 2}, End: protocol.Position{Line: 3, Character: 12}, @@ -275,7 +275,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto dollar attribute", - filename: "testdata/goto-dollar-simple.jsonnet", + filename: "testdata/dollar-simple.jsonnet", position: protocol.Position{Line: 7, Character: 17}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -290,7 +290,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto dollar sub attribute", - filename: "testdata/goto-dollar-simple.jsonnet", + filename: "testdata/dollar-simple.jsonnet", position: protocol.Position{Line: 8, Character: 28}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -305,7 +305,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto dollar doesn't follow to imports", - filename: "testdata/goto-dollar-no-follow.jsonnet", + filename: "testdata/dollar-no-follow.jsonnet", position: protocol.Position{Line: 7, Character: 13}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -320,10 +320,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto attribute of nested import no object intermediary", - filename: "testdata/goto-nested-import-file-no-inter-obj.jsonnet", + filename: "testdata/nested-import-file-no-inter-obj.jsonnet", position: protocol.Position{Line: 2, Character: 13}, results: []definitionResult{{ - targetFilename: "testdata/goto-basic-object.jsonnet", + targetFilename: "testdata/basic-object.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 3, Character: 2}, End: protocol.Position{Line: 3, Character: 12}, @@ -336,10 +336,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto self in import in binary", - filename: "testdata/goto-self-within-binary.jsonnet", + filename: "testdata/self-within-binary.jsonnet", position: protocol.Position{Line: 4, Character: 13}, results: []definitionResult{{ - targetFilename: "testdata/goto-basic-object.jsonnet", + targetFilename: "testdata/basic-object.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 3, Character: 2}, End: protocol.Position{Line: 3, Character: 12}, @@ -352,7 +352,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto self attribute from local", - filename: "testdata/goto-self-in-local.jsonnet", + filename: "testdata/self-in-local.jsonnet", position: protocol.Position{Line: 3, Character: 23}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -367,7 +367,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto function parameter from inside function", - filename: "testdata/goto-functions.libsonnet", + filename: "testdata/functions.libsonnet", position: protocol.Position{Line: 7, Character: 10}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -378,7 +378,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto local func param", - filename: "testdata/goto-local-function.libsonnet", + filename: "testdata/local-function.libsonnet", position: protocol.Position{Line: 2, Character: 25}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -389,7 +389,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto self complex scope 1", - filename: "testdata/goto-self-complex-scoping.jsonnet", + filename: "testdata/self-complex-scoping.jsonnet", position: protocol.Position{Line: 10, Character: 15}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -404,7 +404,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto self complex scope 2", - filename: "testdata/goto-self-complex-scoping.jsonnet", + filename: "testdata/self-complex-scoping.jsonnet", position: protocol.Position{Line: 11, Character: 19}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -419,7 +419,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto with overrides: clobber string", - filename: "testdata/goto-overrides.jsonnet", + filename: "testdata/overrides.jsonnet", position: protocol.Position{Line: 41, Character: 30}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -434,7 +434,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto with overrides: clobber nested string", - filename: "testdata/goto-overrides.jsonnet", + filename: "testdata/overrides.jsonnet", position: protocol.Position{Line: 42, Character: 44}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -449,7 +449,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto with overrides: clobber map", - filename: "testdata/goto-overrides.jsonnet", + filename: "testdata/overrides.jsonnet", position: protocol.Position{Line: 43, Character: 28}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -464,7 +464,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto with overrides: map (multiple definitions)", - filename: "testdata/goto-overrides.jsonnet", + filename: "testdata/overrides.jsonnet", position: protocol.Position{Line: 32, Character: 22}, results: []definitionResult{ { @@ -498,10 +498,10 @@ var definitionTestCases = []definitionTestCase{ }, }, { - targetFilename: "testdata/goto-overrides-base.jsonnet", + targetFilename: "testdata/overrides-base.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 19, Character: 2}, - End: protocol.Position{Line: 19, Character: 94}, + End: protocol.Position{Line: 19, Character: 84}, }, targetSelectionRange: protocol.Range{ Start: protocol.Position{Line: 19, Character: 2}, @@ -509,7 +509,7 @@ var definitionTestCases = []definitionTestCase{ }, }, { - targetFilename: "testdata/goto-overrides-base.jsonnet", + targetFilename: "testdata/overrides-base.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 16, Character: 2}, End: protocol.Position{Line: 16, Character: 24}, @@ -520,7 +520,7 @@ var definitionTestCases = []definitionTestCase{ }, }, { - targetFilename: "testdata/goto-overrides-base.jsonnet", + targetFilename: "testdata/overrides-base.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 1, Character: 2}, End: protocol.Position{Line: 7, Character: 3}, @@ -534,7 +534,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto with overrides: nested map (multiple definitions)", - filename: "testdata/goto-overrides.jsonnet", + filename: "testdata/overrides.jsonnet", position: protocol.Position{Line: 33, Character: 34}, results: []definitionResult{ { @@ -568,7 +568,7 @@ var definitionTestCases = []definitionTestCase{ }, }, { - targetFilename: "testdata/goto-overrides-imported2.jsonnet", + targetFilename: "testdata/overrides-imported2.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 1, Character: 2}, End: protocol.Position{Line: 3, Character: 3}, @@ -579,7 +579,7 @@ var definitionTestCases = []definitionTestCase{ }, }, { - targetFilename: "testdata/goto-overrides-imported.jsonnet", + targetFilename: "testdata/overrides-imported.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 1, Character: 2}, End: protocol.Position{Line: 3, Character: 3}, @@ -590,7 +590,7 @@ var definitionTestCases = []definitionTestCase{ }, }, { - targetFilename: "testdata/goto-overrides-base.jsonnet", + targetFilename: "testdata/overrides-base.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 12, Character: 4}, End: protocol.Position{Line: 14, Character: 5}, @@ -601,7 +601,7 @@ var definitionTestCases = []definitionTestCase{ }, }, { - targetFilename: "testdata/goto-overrides-base.jsonnet", + targetFilename: "testdata/overrides-base.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 3, Character: 4}, End: protocol.Position{Line: 5, Character: 5}, @@ -615,7 +615,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto with overrides: string carried from super", - filename: "testdata/goto-overrides.jsonnet", + filename: "testdata/overrides.jsonnet", position: protocol.Position{Line: 35, Character: 27}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -630,7 +630,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto with overrides: nested string carried from super", - filename: "testdata/goto-overrides.jsonnet", + filename: "testdata/overrides.jsonnet", position: protocol.Position{Line: 36, Character: 44}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -645,10 +645,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto with overrides: string carried from local", - filename: "testdata/goto-overrides.jsonnet", + filename: "testdata/overrides.jsonnet", position: protocol.Position{Line: 37, Character: 57}, results: []definitionResult{{ - targetFilename: "testdata/goto-overrides-base.jsonnet", + targetFilename: "testdata/overrides-base.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 13, Character: 6}, End: protocol.Position{Line: 13, Character: 24}, @@ -661,10 +661,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto with overrides: string carried from import", - filename: "testdata/goto-overrides.jsonnet", + filename: "testdata/overrides.jsonnet", position: protocol.Position{Line: 38, Character: 57}, results: []definitionResult{{ - targetFilename: "testdata/goto-overrides-imported.jsonnet", + targetFilename: "testdata/overrides-imported.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 2, Character: 4}, End: protocol.Position{Line: 2, Character: 23}, @@ -677,10 +677,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto with overrides: string carried from second import", - filename: "testdata/goto-overrides.jsonnet", + filename: "testdata/overrides.jsonnet", position: protocol.Position{Line: 39, Character: 67}, results: []definitionResult{{ - targetFilename: "testdata/goto-overrides-imported2.jsonnet", + targetFilename: "testdata/overrides-imported2.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 2, Character: 4}, End: protocol.Position{Line: 2, Character: 30}, @@ -693,10 +693,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto deeply nested imported attribute", - filename: "testdata/goto-import-nested-main.jsonnet", + filename: "testdata/import-nested-main.jsonnet", position: protocol.Position{Line: 6, Character: 14}, results: []definitionResult{{ - targetFilename: "testdata/goto-import-nested-obj.libsonnet", + targetFilename: "testdata/import-nested-obj.libsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 2, Character: 2}, End: protocol.Position{Line: 2, Character: 26}, @@ -709,10 +709,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto deeply nested imported attribute through self", - filename: "testdata/goto-import-nested-main.jsonnet", + filename: "testdata/import-nested-main.jsonnet", position: protocol.Position{Line: 7, Character: 27}, results: []definitionResult{{ - targetFilename: "testdata/goto-import-nested-obj.libsonnet", + targetFilename: "testdata/import-nested-obj.libsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 2, Character: 2}, End: protocol.Position{Line: 2, Character: 26}, @@ -725,10 +725,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto computed field name object field", - filename: "testdata/goto-computed-field-names.jsonnet", + filename: "testdata/computed-field-names.jsonnet", position: protocol.Position{Line: 3, Character: 9}, results: []definitionResult{{ - targetFilename: "testdata/goto-computed-field-names.jsonnet", + targetFilename: "testdata/computed-field-names.jsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 0, Character: 14}, End: protocol.Position{Line: 0, Character: 26}, @@ -741,7 +741,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto field through function", - filename: "testdata/goto-functions-advanced.libsonnet", + filename: "testdata/functions-advanced.libsonnet", position: protocol.Position{Line: 15, Character: 48}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -756,7 +756,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto field through function-created object", - filename: "testdata/goto-functions-advanced.libsonnet", + filename: "testdata/functions-advanced.libsonnet", position: protocol.Position{Line: 16, Character: 54}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -771,7 +771,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto field through builder pattern attribute", - filename: "testdata/goto-functions-advanced.libsonnet", + filename: "testdata/functions-advanced.libsonnet", position: protocol.Position{Line: 17, Character: 67}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -786,7 +786,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto field through mixin attribute", - filename: "testdata/goto-functions-advanced.libsonnet", + filename: "testdata/functions-advanced.libsonnet", position: protocol.Position{Line: 18, Character: 58}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -801,10 +801,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto attribute of root-function library", - filename: "testdata/goto-root-function.jsonnet", - position: protocol.Position{Line: 5, Character: 70}, + filename: "testdata/root-function.jsonnet", + position: protocol.Position{Line: 5, Character: 65}, results: []definitionResult{{ - targetFilename: "testdata/goto-root-function-lib.libsonnet", + targetFilename: "testdata/root-function-lib.libsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 1, Character: 2}, End: protocol.Position{Line: 1, Character: 22}, @@ -817,10 +817,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto attribute of root-function library through local import", - filename: "testdata/goto-root-function.jsonnet", + filename: "testdata/root-function.jsonnet", position: protocol.Position{Line: 6, Character: 28}, results: []definitionResult{{ - targetFilename: "testdata/goto-root-function-lib.libsonnet", + targetFilename: "testdata/root-function-lib.libsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 1, Character: 2}, End: protocol.Position{Line: 1, Character: 22}, @@ -833,10 +833,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto attribute of root-function library through local resolved import", - filename: "testdata/goto-root-function.jsonnet", + filename: "testdata/root-function.jsonnet", position: protocol.Position{Line: 7, Character: 36}, results: []definitionResult{{ - targetFilename: "testdata/goto-root-function-lib.libsonnet", + targetFilename: "testdata/root-function-lib.libsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 1, Character: 2}, End: protocol.Position{Line: 1, Character: 22}, @@ -849,10 +849,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto nested attribute of root-function library", - filename: "testdata/goto-root-function.jsonnet", + filename: "testdata/root-function.jsonnet", position: protocol.Position{Line: 9, Character: 98}, results: []definitionResult{{ - targetFilename: "testdata/goto-root-function-lib.libsonnet", + targetFilename: "testdata/root-function-lib.libsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 4, Character: 4}, End: protocol.Position{Line: 4, Character: 36}, @@ -865,10 +865,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto nested attribute of root-function library through local import", - filename: "testdata/goto-root-function.jsonnet", + filename: "testdata/root-function.jsonnet", position: protocol.Position{Line: 10, Character: 55}, results: []definitionResult{{ - targetFilename: "testdata/goto-root-function-lib.libsonnet", + targetFilename: "testdata/root-function-lib.libsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 4, Character: 4}, End: protocol.Position{Line: 4, Character: 36}, @@ -881,10 +881,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto nested attribute of root-function library through local resolved import", - filename: "testdata/goto-root-function.jsonnet", + filename: "testdata/root-function.jsonnet", position: protocol.Position{Line: 11, Character: 64}, results: []definitionResult{{ - targetFilename: "testdata/goto-root-function-lib.libsonnet", + targetFilename: "testdata/root-function-lib.libsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 4, Character: 4}, End: protocol.Position{Line: 4, Character: 36}, @@ -897,10 +897,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto function nested multiple times in different ways", - filename: "testdata/goto-multilevel-library-main.jsonnet", + filename: "testdata/multilevel-library-main.jsonnet", position: protocol.Position{Line: 2, Character: 34}, results: []definitionResult{{ - targetFilename: "testdata/goto-multilevel-library-sub-1.1.libsonnet", + targetFilename: "testdata/multilevel-library-sub-1.1.libsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 1, Character: 2}, End: protocol.Position{Line: 1, Character: 28}, @@ -913,10 +913,10 @@ var definitionTestCases = []definitionTestCase{ }, { name: "test fix infinite recursion", - filename: "./testdata/goto-infinite-recursion-bug-1.jsonnet", + filename: "./testdata/infinite-recursion-bug-1.jsonnet", position: protocol.Position{Line: 2, Character: 26}, results: []definitionResult{{ - targetFilename: "testdata/goto-infinite-recursion-bug-3.libsonnet", + targetFilename: "testdata/infinite-recursion-bug-3.libsonnet", targetRange: protocol.Range{ Start: protocol.Position{Line: 5, Character: 10}, End: protocol.Position{Line: 5, Character: 36}, @@ -945,7 +945,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto assert local var", - filename: "testdata/goto-assert-var.jsonnet", + filename: "testdata/assert-var.jsonnet", position: protocol.Position{Line: 3, Character: 11}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -960,7 +960,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto assert self var", - filename: "testdata/goto-assert-var.jsonnet", + filename: "testdata/assert-var.jsonnet", position: protocol.Position{Line: 3, Character: 23}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -975,7 +975,7 @@ var definitionTestCases = []definitionTestCase{ }, { name: "goto builder pattern function", - filename: "testdata/goto-builder-pattern.jsonnet", + filename: "testdata/builder-pattern.jsonnet", position: protocol.Position{Line: 21, Character: 62}, results: []definitionResult{{ targetRange: protocol.Range{ @@ -1064,32 +1064,32 @@ func TestDefinitionFail(t *testing.T) { }{ { name: "goto local keyword fails", - filename: "testdata/goto-basic-object.jsonnet", + filename: "testdata/basic-object.jsonnet", position: protocol.Position{Line: 0, Character: 3}, expected: fmt.Errorf("cannot find definition"), }, { name: "goto index of std fails", - filename: "testdata/goto-std.jsonnet", + filename: "testdata/std.jsonnet", position: protocol.Position{Line: 1, Character: 20}, expected: fmt.Errorf("cannot get definition of std lib"), }, { name: "goto comment fails", - filename: "testdata/goto-comment.jsonnet", + filename: "testdata/comment.jsonnet", position: protocol.Position{Line: 0, Character: 1}, expected: fmt.Errorf("cannot find definition"), }, { name: "goto super fails as no LHS object exists", - filename: "testdata/goto-local-function.libsonnet", + filename: "testdata/local-function.libsonnet", position: protocol.Position{Line: 33, Character: 23}, expected: fmt.Errorf("could not find a lhs object"), }, { name: "goto self fails when out of scope", - filename: "testdata/goto-self-complex-scoping.jsonnet", + filename: "testdata/self-complex-scoping.jsonnet", position: protocol.Position{Line: 3, Character: 18}, expected: fmt.Errorf("field test was not found in ast.DesugaredObject"), }, diff --git a/pkg/server/hover_test.go b/pkg/server/hover_test.go index d1ffea6..2622a77 100644 --- a/pkg/server/hover_test.go +++ b/pkg/server/hover_test.go @@ -254,7 +254,7 @@ func TestHover(t *testing.T) { }{ { name: "hover on nested attribute", - filename: "testdata/goto-indexes.jsonnet", + filename: "testdata/indexes.jsonnet", position: protocol.Position{Line: 9, Character: 16}, expectedContent: protocol.Hover{ Contents: protocol.MarkupContent{ @@ -269,7 +269,7 @@ func TestHover(t *testing.T) { }, { name: "hover on multi-line string", - filename: "testdata/goto-indexes.jsonnet", + filename: "testdata/indexes.jsonnet", position: protocol.Position{Line: 8, Character: 9}, expectedContent: protocol.Hover{ Contents: protocol.MarkupContent{ diff --git a/pkg/server/symbols_test.go b/pkg/server/symbols_test.go index 609d223..ac088ec 100644 --- a/pkg/server/symbols_test.go +++ b/pkg/server/symbols_test.go @@ -17,7 +17,7 @@ func TestSymbols(t *testing.T) { }{ { name: "One field", - filename: "testdata/goto-comment.jsonnet", + filename: "testdata/comment.jsonnet", expectSymbols: []interface{}{ protocol.DocumentSymbol{ Name: "foo", @@ -48,7 +48,7 @@ func TestSymbols(t *testing.T) { }, { name: "local var + two fields from plus root objects", - filename: "testdata/goto-basic-object.jsonnet", + filename: "testdata/basic-object.jsonnet", expectSymbols: []interface{}{ protocol.DocumentSymbol{ Name: "somevar", @@ -129,7 +129,7 @@ func TestSymbols(t *testing.T) { }, { name: "Functions", - filename: "testdata/goto-functions.libsonnet", + filename: "testdata/functions.libsonnet", expectSymbols: []interface{}{ protocol.DocumentSymbol{ Name: "myfunc", @@ -186,7 +186,7 @@ func TestSymbols(t *testing.T) { }, { name: "Computed fields", - filename: "testdata/goto-computed-field-names.jsonnet", + filename: "testdata/computed-field-names.jsonnet", expectSymbols: []interface{}{ protocol.DocumentSymbol{ Name: "obj", diff --git a/pkg/server/testdata/goto-assert-var.jsonnet b/pkg/server/testdata/assert-var.jsonnet similarity index 100% rename from pkg/server/testdata/goto-assert-var.jsonnet rename to pkg/server/testdata/assert-var.jsonnet diff --git a/pkg/server/testdata/goto-basic-object.jsonnet b/pkg/server/testdata/basic-object.jsonnet similarity index 100% rename from pkg/server/testdata/goto-basic-object.jsonnet rename to pkg/server/testdata/basic-object.jsonnet diff --git a/pkg/server/testdata/goto-builder-pattern.jsonnet b/pkg/server/testdata/builder-pattern.jsonnet similarity index 100% rename from pkg/server/testdata/goto-builder-pattern.jsonnet rename to pkg/server/testdata/builder-pattern.jsonnet diff --git a/pkg/server/testdata/goto-comment.jsonnet b/pkg/server/testdata/comment.jsonnet similarity index 100% rename from pkg/server/testdata/goto-comment.jsonnet rename to pkg/server/testdata/comment.jsonnet diff --git a/pkg/server/testdata/goto-computed-field-names.jsonnet b/pkg/server/testdata/computed-field-names.jsonnet similarity index 100% rename from pkg/server/testdata/goto-computed-field-names.jsonnet rename to pkg/server/testdata/computed-field-names.jsonnet diff --git a/pkg/server/testdata/goto-dollar-no-follow.jsonnet b/pkg/server/testdata/dollar-no-follow.jsonnet similarity index 75% rename from pkg/server/testdata/goto-dollar-no-follow.jsonnet rename to pkg/server/testdata/dollar-no-follow.jsonnet index b8fab60..0292799 100644 --- a/pkg/server/testdata/goto-dollar-no-follow.jsonnet +++ b/pkg/server/testdata/dollar-no-follow.jsonnet @@ -1,4 +1,4 @@ -local imported = import 'goto-dollar-simple.jsonnet'; +local imported = import 'dollar-simple.jsonnet'; { test: imported.attribute.sub, diff --git a/pkg/server/testdata/goto-dollar-simple.jsonnet b/pkg/server/testdata/dollar-simple.jsonnet similarity index 100% rename from pkg/server/testdata/goto-dollar-simple.jsonnet rename to pkg/server/testdata/dollar-simple.jsonnet diff --git a/pkg/server/testdata/goto-functions-advanced.libsonnet b/pkg/server/testdata/functions-advanced.libsonnet similarity index 100% rename from pkg/server/testdata/goto-functions-advanced.libsonnet rename to pkg/server/testdata/functions-advanced.libsonnet diff --git a/pkg/server/testdata/goto-functions.libsonnet b/pkg/server/testdata/functions.libsonnet similarity index 100% rename from pkg/server/testdata/goto-functions.libsonnet rename to pkg/server/testdata/functions.libsonnet diff --git a/pkg/server/testdata/goto-import-attribute.jsonnet b/pkg/server/testdata/goto-import-attribute.jsonnet deleted file mode 100644 index 26ea507..0000000 --- a/pkg/server/testdata/goto-import-attribute.jsonnet +++ /dev/null @@ -1,2 +0,0 @@ -local foo = (import 'goto-basic-object.jsonnet').bar; -{} diff --git a/pkg/server/testdata/goto-import-intermediary.libsonnet b/pkg/server/testdata/goto-import-intermediary.libsonnet deleted file mode 100644 index 2c244a5..0000000 --- a/pkg/server/testdata/goto-import-intermediary.libsonnet +++ /dev/null @@ -1,3 +0,0 @@ -{ - otherFile: (import 'goto-basic-object.jsonnet'), -} diff --git a/pkg/server/testdata/goto-import-nested1.libsonnet b/pkg/server/testdata/goto-import-nested1.libsonnet deleted file mode 100644 index f21f850..0000000 --- a/pkg/server/testdata/goto-import-nested1.libsonnet +++ /dev/null @@ -1,7 +0,0 @@ -{ - api:: { - v1:: { - obj:: import 'goto-import-nested-obj.libsonnet', - }, - }, -} diff --git a/pkg/server/testdata/goto-import-no-obj.libsonnet b/pkg/server/testdata/goto-import-no-obj.libsonnet deleted file mode 100644 index 1df53de..0000000 --- a/pkg/server/testdata/goto-import-no-obj.libsonnet +++ /dev/null @@ -1 +0,0 @@ -(import 'goto-basic-object.jsonnet') diff --git a/pkg/server/testdata/goto-imported-file.jsonnet b/pkg/server/testdata/goto-imported-file.jsonnet deleted file mode 100644 index 2ce7fc5..0000000 --- a/pkg/server/testdata/goto-imported-file.jsonnet +++ /dev/null @@ -1,6 +0,0 @@ -local otherfile = import 'goto-basic-object.jsonnet'; - -{ - a: otherfile.foo, - b: otherfile.bar, -} diff --git a/pkg/server/testdata/goto-infinite-recursion-bug-1.jsonnet b/pkg/server/testdata/goto-infinite-recursion-bug-1.jsonnet deleted file mode 100644 index a1592c5..0000000 --- a/pkg/server/testdata/goto-infinite-recursion-bug-1.jsonnet +++ /dev/null @@ -1,6 +0,0 @@ -local drone = import './goto-infinite-recursion-bug-2.libsonnet'; -{ - steps: drone.step.withCommands([ - 'blabla', - ]), -} diff --git a/pkg/server/testdata/goto-multilevel-library-main.jsonnet b/pkg/server/testdata/goto-multilevel-library-main.jsonnet deleted file mode 100644 index 92cc427..0000000 --- a/pkg/server/testdata/goto-multilevel-library-main.jsonnet +++ /dev/null @@ -1,4 +0,0 @@ -local library = import 'goto-multilevel-library-top.libsonnet'; -{ - my_item: library.sub1.subsub1.new(name='test'), -} diff --git a/pkg/server/testdata/goto-multilevel-library-sub-1.libsonnet b/pkg/server/testdata/goto-multilevel-library-sub-1.libsonnet deleted file mode 100644 index 2b24cfb..0000000 --- a/pkg/server/testdata/goto-multilevel-library-sub-1.libsonnet +++ /dev/null @@ -1,4 +0,0 @@ -{ - subsub1: import 'goto-multilevel-library-sub-1.1.libsonnet', - subsub2: import 'goto-multilevel-library-sub-1.2.libsonnet', -} diff --git a/pkg/server/testdata/goto-multilevel-library-top.libsonnet b/pkg/server/testdata/goto-multilevel-library-top.libsonnet deleted file mode 100644 index d6075ae..0000000 --- a/pkg/server/testdata/goto-multilevel-library-top.libsonnet +++ /dev/null @@ -1,7 +0,0 @@ -local sub1 = import 'goto-multilevel-library-sub-1.libsonnet'; -local sub2 = import 'goto-multilevel-library-sub-2.libsonnet'; - -{ - sub1:: sub1, - sub2:: sub2, -} diff --git a/pkg/server/testdata/goto-nested-import-file-no-inter-obj.jsonnet b/pkg/server/testdata/goto-nested-import-file-no-inter-obj.jsonnet deleted file mode 100644 index 279d4f2..0000000 --- a/pkg/server/testdata/goto-nested-import-file-no-inter-obj.jsonnet +++ /dev/null @@ -1,4 +0,0 @@ -local file = (import 'goto-import-no-obj.libsonnet'); -{ - foo: file.foo, -} diff --git a/pkg/server/testdata/goto-nested-imported-file.jsonnet b/pkg/server/testdata/goto-nested-imported-file.jsonnet deleted file mode 100644 index b6dddf4..0000000 --- a/pkg/server/testdata/goto-nested-imported-file.jsonnet +++ /dev/null @@ -1,4 +0,0 @@ -local file = (import 'goto-import-intermediary.libsonnet').otherFile; -{ - foo: file.foo, -} diff --git a/pkg/server/testdata/goto-root-function.jsonnet b/pkg/server/testdata/goto-root-function.jsonnet deleted file mode 100644 index 9eb4f5b..0000000 --- a/pkg/server/testdata/goto-root-function.jsonnet +++ /dev/null @@ -1,13 +0,0 @@ -local lib = import 'goto-root-function-lib.libsonnet'; -local libResolved = (import 'goto-root-function-lib.libsonnet')('test'); - -{ - - fromImport: (import 'goto-root-function-lib.libsonnet')('test').attribute, - fromLib: lib('test').attribute, - fromResolvedLib: libResolved.attribute, - - nestedFromImport: (import 'goto-root-function-lib.libsonnet')('test').nestedFunc('test').nestedAttribute, - nestedFromLib: lib('test').nestedFunc('test').nestedAttribute, - nestedFromResolvedLib: libResolved.nestedFunc('test').nestedAttribute, -} diff --git a/pkg/server/testdata/import-attribute.jsonnet b/pkg/server/testdata/import-attribute.jsonnet new file mode 100644 index 0000000..0206145 --- /dev/null +++ b/pkg/server/testdata/import-attribute.jsonnet @@ -0,0 +1,2 @@ +local foo = (import 'basic-object.jsonnet').bar; +{} diff --git a/pkg/server/testdata/import-intermediary.libsonnet b/pkg/server/testdata/import-intermediary.libsonnet new file mode 100644 index 0000000..bfcf165 --- /dev/null +++ b/pkg/server/testdata/import-intermediary.libsonnet @@ -0,0 +1,3 @@ +{ + otherFile: (import 'basic-object.jsonnet'), +} diff --git a/pkg/server/testdata/goto-import-nested-main.jsonnet b/pkg/server/testdata/import-nested-main.jsonnet similarity index 72% rename from pkg/server/testdata/goto-import-nested-main.jsonnet rename to pkg/server/testdata/import-nested-main.jsonnet index bc04744..8ce85f1 100644 --- a/pkg/server/testdata/goto-import-nested-main.jsonnet +++ b/pkg/server/testdata/import-nested-main.jsonnet @@ -1,4 +1,4 @@ -local imported = import 'goto-import-nested3.libsonnet'; +local imported = import 'import-nested3.libsonnet'; local obj = imported.api.v1.obj; { diff --git a/pkg/server/testdata/goto-import-nested-obj.libsonnet b/pkg/server/testdata/import-nested-obj.libsonnet similarity index 100% rename from pkg/server/testdata/goto-import-nested-obj.libsonnet rename to pkg/server/testdata/import-nested-obj.libsonnet diff --git a/pkg/server/testdata/import-nested1.libsonnet b/pkg/server/testdata/import-nested1.libsonnet new file mode 100644 index 0000000..73a5a66 --- /dev/null +++ b/pkg/server/testdata/import-nested1.libsonnet @@ -0,0 +1,7 @@ +{ + api:: { + v1:: { + obj:: import 'import-nested-obj.libsonnet', + }, + }, +} diff --git a/pkg/server/testdata/goto-import-nested2.libsonnet b/pkg/server/testdata/import-nested2.libsonnet similarity index 56% rename from pkg/server/testdata/goto-import-nested2.libsonnet rename to pkg/server/testdata/import-nested2.libsonnet index 93c3607..86170ae 100644 --- a/pkg/server/testdata/goto-import-nested2.libsonnet +++ b/pkg/server/testdata/import-nested2.libsonnet @@ -1,4 +1,4 @@ -local base = import 'goto-import-nested1.libsonnet'; +local base = import 'import-nested1.libsonnet'; base { api+:: { diff --git a/pkg/server/testdata/goto-import-nested3.libsonnet b/pkg/server/testdata/import-nested3.libsonnet similarity index 75% rename from pkg/server/testdata/goto-import-nested3.libsonnet rename to pkg/server/testdata/import-nested3.libsonnet index 5d6a4ee..8ce8242 100644 --- a/pkg/server/testdata/goto-import-nested3.libsonnet +++ b/pkg/server/testdata/import-nested3.libsonnet @@ -1,4 +1,4 @@ -(import 'goto-import-nested2.libsonnet') +(import 'import-nested2.libsonnet') + { local this = self, _config+:: { diff --git a/pkg/server/testdata/import-no-obj.libsonnet b/pkg/server/testdata/import-no-obj.libsonnet new file mode 100644 index 0000000..724f299 --- /dev/null +++ b/pkg/server/testdata/import-no-obj.libsonnet @@ -0,0 +1 @@ +(import 'basic-object.jsonnet') diff --git a/pkg/server/testdata/imported-file.jsonnet b/pkg/server/testdata/imported-file.jsonnet new file mode 100644 index 0000000..aba5b86 --- /dev/null +++ b/pkg/server/testdata/imported-file.jsonnet @@ -0,0 +1,6 @@ +local otherfile = import 'basic-object.jsonnet'; + +{ + a: otherfile.foo, + b: otherfile.bar, +} diff --git a/pkg/server/testdata/goto-indexes.jsonnet b/pkg/server/testdata/indexes.jsonnet similarity index 100% rename from pkg/server/testdata/goto-indexes.jsonnet rename to pkg/server/testdata/indexes.jsonnet diff --git a/pkg/server/testdata/infinite-recursion-bug-1.jsonnet b/pkg/server/testdata/infinite-recursion-bug-1.jsonnet new file mode 100644 index 0000000..f0a85e5 --- /dev/null +++ b/pkg/server/testdata/infinite-recursion-bug-1.jsonnet @@ -0,0 +1,6 @@ +local drone = import './infinite-recursion-bug-2.libsonnet'; +{ + steps: drone.step.withCommands([ + 'blabla', + ]), +} diff --git a/pkg/server/testdata/goto-infinite-recursion-bug-2.libsonnet b/pkg/server/testdata/infinite-recursion-bug-2.libsonnet similarity index 82% rename from pkg/server/testdata/goto-infinite-recursion-bug-2.libsonnet rename to pkg/server/testdata/infinite-recursion-bug-2.libsonnet index 53b2dd4..f3b4ac6 100644 --- a/pkg/server/testdata/goto-infinite-recursion-bug-2.libsonnet +++ b/pkg/server/testdata/infinite-recursion-bug-2.libsonnet @@ -1,4 +1,4 @@ -local drone = import './goto-infinite-recursion-bug-3.libsonnet'; +local drone = import './infinite-recursion-bug-3.libsonnet'; { pipeline: drone.pipeline.docker { diff --git a/pkg/server/testdata/goto-infinite-recursion-bug-3.libsonnet b/pkg/server/testdata/infinite-recursion-bug-3.libsonnet similarity index 100% rename from pkg/server/testdata/goto-infinite-recursion-bug-3.libsonnet rename to pkg/server/testdata/infinite-recursion-bug-3.libsonnet diff --git a/pkg/server/testdata/goto-local-function.libsonnet b/pkg/server/testdata/local-function.libsonnet similarity index 100% rename from pkg/server/testdata/goto-local-function.libsonnet rename to pkg/server/testdata/local-function.libsonnet diff --git a/pkg/server/testdata/multilevel-library-main.jsonnet b/pkg/server/testdata/multilevel-library-main.jsonnet new file mode 100644 index 0000000..15e0361 --- /dev/null +++ b/pkg/server/testdata/multilevel-library-main.jsonnet @@ -0,0 +1,4 @@ +local library = import 'multilevel-library-top.libsonnet'; +{ + my_item: library.sub1.subsub1.new(name='test'), +} diff --git a/pkg/server/testdata/goto-multilevel-library-sub-1.1.libsonnet b/pkg/server/testdata/multilevel-library-sub-1.1.libsonnet similarity index 100% rename from pkg/server/testdata/goto-multilevel-library-sub-1.1.libsonnet rename to pkg/server/testdata/multilevel-library-sub-1.1.libsonnet diff --git a/pkg/server/testdata/goto-multilevel-library-sub-1.2.libsonnet b/pkg/server/testdata/multilevel-library-sub-1.2.libsonnet similarity index 100% rename from pkg/server/testdata/goto-multilevel-library-sub-1.2.libsonnet rename to pkg/server/testdata/multilevel-library-sub-1.2.libsonnet diff --git a/pkg/server/testdata/multilevel-library-sub-1.libsonnet b/pkg/server/testdata/multilevel-library-sub-1.libsonnet new file mode 100644 index 0000000..6d81a68 --- /dev/null +++ b/pkg/server/testdata/multilevel-library-sub-1.libsonnet @@ -0,0 +1,4 @@ +{ + subsub1: import 'multilevel-library-sub-1.1.libsonnet', + subsub2: import 'multilevel-library-sub-1.2.libsonnet', +} diff --git a/pkg/server/testdata/goto-multilevel-library-sub-2.libsonnet b/pkg/server/testdata/multilevel-library-sub-2.libsonnet similarity index 100% rename from pkg/server/testdata/goto-multilevel-library-sub-2.libsonnet rename to pkg/server/testdata/multilevel-library-sub-2.libsonnet diff --git a/pkg/server/testdata/multilevel-library-top.libsonnet b/pkg/server/testdata/multilevel-library-top.libsonnet new file mode 100644 index 0000000..6b2aa1c --- /dev/null +++ b/pkg/server/testdata/multilevel-library-top.libsonnet @@ -0,0 +1,7 @@ +local sub1 = import 'multilevel-library-sub-1.libsonnet'; +local sub2 = import 'multilevel-library-sub-2.libsonnet'; + +{ + sub1:: sub1, + sub2:: sub2, +} diff --git a/pkg/server/testdata/nested-import-file-no-inter-obj.jsonnet b/pkg/server/testdata/nested-import-file-no-inter-obj.jsonnet new file mode 100644 index 0000000..8d6faff --- /dev/null +++ b/pkg/server/testdata/nested-import-file-no-inter-obj.jsonnet @@ -0,0 +1,4 @@ +local file = (import 'import-no-obj.libsonnet'); +{ + foo: file.foo, +} diff --git a/pkg/server/testdata/nested-imported-file.jsonnet b/pkg/server/testdata/nested-imported-file.jsonnet new file mode 100644 index 0000000..e5774bb --- /dev/null +++ b/pkg/server/testdata/nested-imported-file.jsonnet @@ -0,0 +1,4 @@ +local file = (import 'import-intermediary.libsonnet').otherFile; +{ + foo: file.foo, +} diff --git a/pkg/server/testdata/goto-overrides-base.jsonnet b/pkg/server/testdata/overrides-base.jsonnet similarity index 72% rename from pkg/server/testdata/goto-overrides-base.jsonnet rename to pkg/server/testdata/overrides-base.jsonnet index 92bb46f..09d09d0 100644 --- a/pkg/server/testdata/goto-overrides-base.jsonnet +++ b/pkg/server/testdata/overrides-base.jsonnet @@ -17,5 +17,5 @@ a+: extensionFromLocal, } + { - a+: (import 'goto-overrides-imported.jsonnet') + (import 'goto-overrides-imported2.jsonnet'), + a+: (import 'overrides-imported.jsonnet') + (import 'overrides-imported2.jsonnet'), } diff --git a/pkg/server/testdata/goto-overrides-imported.jsonnet b/pkg/server/testdata/overrides-imported.jsonnet similarity index 100% rename from pkg/server/testdata/goto-overrides-imported.jsonnet rename to pkg/server/testdata/overrides-imported.jsonnet diff --git a/pkg/server/testdata/goto-overrides-imported2.jsonnet b/pkg/server/testdata/overrides-imported2.jsonnet similarity index 100% rename from pkg/server/testdata/goto-overrides-imported2.jsonnet rename to pkg/server/testdata/overrides-imported2.jsonnet diff --git a/pkg/server/testdata/goto-overrides.jsonnet b/pkg/server/testdata/overrides.jsonnet similarity index 95% rename from pkg/server/testdata/goto-overrides.jsonnet rename to pkg/server/testdata/overrides.jsonnet index b7cd3d9..e7b6918 100644 --- a/pkg/server/testdata/goto-overrides.jsonnet +++ b/pkg/server/testdata/overrides.jsonnet @@ -1,4 +1,4 @@ -(import 'goto-overrides-base.jsonnet') + // 1. Initial definition from base file +(import 'overrides-base.jsonnet') + // 1. Initial definition from base file { // 2. Override nested string a+: { hello: 'world', diff --git a/pkg/server/testdata/goto-root-function-lib.libsonnet b/pkg/server/testdata/root-function-lib.libsonnet similarity index 100% rename from pkg/server/testdata/goto-root-function-lib.libsonnet rename to pkg/server/testdata/root-function-lib.libsonnet diff --git a/pkg/server/testdata/root-function.jsonnet b/pkg/server/testdata/root-function.jsonnet new file mode 100644 index 0000000..c110d28 --- /dev/null +++ b/pkg/server/testdata/root-function.jsonnet @@ -0,0 +1,13 @@ +local lib = import 'root-function-lib.libsonnet'; +local libResolved = (import 'root-function-lib.libsonnet')('test'); + +{ + + fromImport: (import 'root-function-lib.libsonnet')('test').attribute, + fromLib: lib('test').attribute, + fromResolvedLib: libResolved.attribute, + + nestedFromImport: (import 'root-function-lib.libsonnet')('test').nestedFunc('test').nestedAttribute, + nestedFromLib: lib('test').nestedFunc('test').nestedAttribute, + nestedFromResolvedLib: libResolved.nestedFunc('test').nestedAttribute, +} diff --git a/pkg/server/testdata/goto-self-complex-scoping.jsonnet b/pkg/server/testdata/self-complex-scoping.jsonnet similarity index 100% rename from pkg/server/testdata/goto-self-complex-scoping.jsonnet rename to pkg/server/testdata/self-complex-scoping.jsonnet diff --git a/pkg/server/testdata/goto-self-in-local.jsonnet b/pkg/server/testdata/self-in-local.jsonnet similarity index 100% rename from pkg/server/testdata/goto-self-in-local.jsonnet rename to pkg/server/testdata/self-in-local.jsonnet diff --git a/pkg/server/testdata/goto-self-within-binary.jsonnet b/pkg/server/testdata/self-within-binary.jsonnet similarity index 52% rename from pkg/server/testdata/goto-self-within-binary.jsonnet rename to pkg/server/testdata/self-within-binary.jsonnet index 87666ca..e3164e6 100644 --- a/pkg/server/testdata/goto-self-within-binary.jsonnet +++ b/pkg/server/testdata/self-within-binary.jsonnet @@ -1,4 +1,4 @@ -(import 'goto-basic-object.jsonnet') + +(import 'basic-object.jsonnet') + { aaa: 'hello', } + { diff --git a/pkg/server/testdata/goto-std.jsonnet b/pkg/server/testdata/std.jsonnet similarity index 100% rename from pkg/server/testdata/goto-std.jsonnet rename to pkg/server/testdata/std.jsonnet