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

Suggestion: documenting the (actual, expected) order for all languages #390

Open
interrupt-routine opened this issue Apr 29, 2022 · 3 comments

Comments

@interrupt-routine
Copy link

This applies to all languages for which the test framework boils down to functions in the form : assert_equal(actual, expected).

For some languages (e.g. Python, JS, C ...) the order is (actual, expected), for some others (Java, C# ...) the order is (expected, actual). This results in a lot of mistakes; issues complaining that "actual and expected are flipped" are widespread.
It is hard to remember the order for the dozens of languages that codewars support, especially when trying to fix issues in a language with which one is not familiar.
My suggestion is to add a page in the codewars docs that would contain a table listing the parameters' order for each language to which it applies, so that it can be checked quickly.

For example something like this:

Language Parameters order
C (actual, expected)
C# (expected, actual)
JavaScript (actual, expected)
Java (expected, actual)
Python (actual, expected)

Alternatively, this could be added on a per-language basis on each language's doc page.

@hobovsky
Copy link
Contributor

Every language supported by Codewars (https://docs.codewars.com/languages) has its documentation page. The page for every language mentions what testing framework is used, and what assertion library is used. For home-grown frameworks, like Codewars Python Testing Framework, documentation should contain reference of test utilities, assertions, etc. (like here for Python). For external frameworks and libraries, authors are expected to refer to documentation provided by these (C uses Criterion, C# uses NUnit, Java uses JUnit, etc.). Ideally, Codewars docs should contain links to home page of all external libraries provided by runner.

So basically things you are asking for are already (mostly) documented. If something is not, for some language, or some framework, it should be added, but for majority of cases I think it's already there.

Did you find any language or test framework which is not documented, or not linked, clearly enough in Codewars docs?

@interrupt-routine
Copy link
Author

Obviously, after a certain amount of research, I will end up finding the documentation snippet I'm looking for.
If you want a specific example : the documentation for C# is just a link to nunit.org. After a bunch of additional clicks, I will land on https://docs.nunit.org/articles/nunit/writing-tests/assertions/classic-assertions/Assert.AreEqual.html that will tell me what I want to know. But the reality is, that there are dozens of C# katas with expected and actual flipped, probably because it's the other way around in most languages.
I just thought documenting it clearly and concisely somewhere would help alleviate the problem, especially when fixing language versions in which one is not familiar (not everyone can remember the details of 40+ frameworks).
Anyway, that was just an idea...

@hobovsky
Copy link
Contributor

hobovsky commented May 1, 2022

Don't get me wrong, I am not saying your idea is bad. What I am saying is that I am not sure that such page would help. Your proposal basically boils down to adding a documentation page for people who did not bother to read docs in the first place.

Additionally, order of expected and actual is not the only thing translators get wrong, and it will be difficult to create a summary of all most important aspects of all testing frameworks on a single page.

The amount of "expected and actual are swapped" has significantly decreased compared to what it used to be several months ago. I'd risk a statement that many (but obviously not all) occurrences of such issue have already been identified, and fixed. When you find any new one, just raise an issue and someone will fix it.

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

No branches or pull requests

2 participants