This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/master by this push: new 932c1d8 LanguageXML is not included in languages list #634 932c1d8 is described below commit 932c1d85fb892148db3b1799393df1e03affb91b Author: lburgazzoli <lburgazz...@gmail.com> AuthorDate: Wed Apr 24 22:26:17 2019 +0200 LanguageXML is not included in languages list #634 --- pkg/apis/camel/v1alpha1/integration_types.go | 2 +- .../v1alpha1/integration_types_support_test.go | 30 +++++++++++++++++----- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/pkg/apis/camel/v1alpha1/integration_types.go b/pkg/apis/camel/v1alpha1/integration_types.go index 0495ef7..2edd3d8 100644 --- a/pkg/apis/camel/v1alpha1/integration_types.go +++ b/pkg/apis/camel/v1alpha1/integration_types.go @@ -110,9 +110,9 @@ const ( var Languages = []Language{ LanguageJavaSource, LanguageJavaClass, - LanguageJavaScript, LanguageGroovy, LanguageJavaScript, + LanguageXML, LanguageKotlin, LanguageYamlFlow, } diff --git a/pkg/apis/camel/v1alpha1/integration_types_support_test.go b/pkg/apis/camel/v1alpha1/integration_types_support_test.go index ab2f8a4..48e6e26 100644 --- a/pkg/apis/camel/v1alpha1/integration_types_support_test.go +++ b/pkg/apis/camel/v1alpha1/integration_types_support_test.go @@ -18,18 +18,36 @@ limitations under the License. package v1alpha1 import ( + "fmt" "testing" "github.com/stretchr/testify/assert" ) -func TestLanguageJavaSource(t *testing.T) { - code := SourceSpec{ - DataSpec: DataSpec{ - Name: "Request.java", - }, +func TestAllLanguages(t *testing.T) { + assert.Contains(t, Languages, LanguageJavaClass) + assert.Contains(t, Languages, LanguageJavaSource) + assert.Contains(t, Languages, LanguageJavaScript) + assert.Contains(t, Languages, LanguageGroovy) + assert.Contains(t, Languages, LanguageKotlin) + assert.Contains(t, Languages, LanguageXML) + assert.Contains(t, Languages, LanguageYamlFlow) +} + +func TestLanguageFromName(t *testing.T) { + for _, l := range Languages { + t.Run(string(l), func(t *testing.T) { + code := SourceSpec{ + DataSpec: DataSpec{ + Name: fmt.Sprintf("code.%s", l), + }, + } + + if l != code.InferLanguage() { + t.Errorf("got %s, want %s", code.InferLanguage(), l) + } + }) } - assert.Equal(t, LanguageJavaSource, code.InferLanguage()) } func TestLanguageAlreadySet(t *testing.T) {