Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds TestUASTGetLanguagesSuite/TestSameEnryLanguage #412

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

se7entyse7en
Copy link
Contributor

Closes #314.

This test ensures that the language label returned by enry is the same
used by bblfsh.

This test ensures that the language label returned by enry is the same
used by bblfsh

Signed-off-by: Lou Marvin Caraig <[email protected]>

if langName == "Bash" {
require.NotEqual(langName, detectedLang)
t.Skip("TEST FAILURE IS A KNOWN ISSUE")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? Isn't this due to the aliasing problem that we also have on engine? But shouldn't it be true also for C#?

Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>

content, filename := suite.getContentAndFilename(langName)
jsonRequest := fmt.Sprintf(`{ "content": "%s", "filename": "%s" }`,
escapeForJSON(content), filename)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this manual escape you could do

			j := struct {
				Filename string
				Content  string
			}{
				Filename: filename,
				Content:  content,
			}

			b, _ := json.Marshal(j)
			req, _ := http.NewRequest("POST", "/detect-lang", bytes.NewReader(b))

or export detectLangRequest type and

			j := handler.DetectLangRequest{
				Filename: filename,
				Content:  content,
			}

			b, _ := json.Marshal(j)
			req, _ := http.NewRequest("POST", "/detect-lang", bytes.NewReader(b))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the tip! Done here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write test to check the language names returned by bblfsh and enry match
2 participants