by staticassertion · 6y ago · 0 comments
It doesn't even show methods or things like that. I think 90% of the docs I've read so far should have just been a single page with one liners one after the other, and less interesting stuff that's got more depth should go further back. I don't think showing nested arrays and dictionaries is interesting to me after you've just told me about some super interesting testing / correctness stuff - lead with that!
I skipped ahead to Decision Making. I think the example is so strange and contrived - three functions, each returns some number above 100, some logic after that that feels arbitrary? I would do something at least a little more universal like fib.
The end of this section states "100% testable" - I'm confused. Why is this testable?
I could not write one unit test to have 100% code coverage, not even line coverage.
If I, for example, wrote a test that used the code provided, with an assertion
assert add(3, 5) == 101
I would not hit f2 or f3, so I'm confused by: "A single unit test is enough to have 100% coverage on functions, always."
That unit test was definitely not enough for 100% coverage.
I skimmed the rest.
For a language that states it's great for testing and preventing errors, I am at a loss as to how one would write a test for it, or handle an error.
This looks like a pretty neat language, but you really gave me such a good hook and then no follow through.
(You're not testing the conditions that lead to calling one of the `f` functions. Maybe it's chalked up to integration testing?)
But yeah, I share much of your frustration. The Decision making section should be the first thing, and it should have a test example. Longer non-trivial programs examples should be contrived to reassure people that this not utterly impractical.
As you say, there's full line coverage for tests, but no guarantee of full equivalence-partition coverage. It's quite possible for branch-free code to fail on certain values. ctrl-f for overflow in [2]
The 'Showcase' link is broken, the GitHub repo seems to show no examples, and the linked StackOverflow chaos tag is never used in relation to this language, so as you say, I'm not sure how serious this language really is. Fun idea though.
(It's entirely possible I'm misusing the term boundary-value analysis. Corrections welcome.)
[0] https://chaos-lang.org/docs/11_decision_making