Syntax proposal
Nobody has claimed this yet.
- Dominant language
- Elixir
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
As @lpil challenged me yesterday, here's a first draft at a test syntax that I think could be achieved.
``` elixir
# Makes the syntax look more sugary.
# Note that given's arguments are lists,
# hence the double-list.
def empty_list do
[[]]
end
# A value of any type.
# Elixir has more, but you get the point.
# This would probably be provided as part of the test framework.
#
# This has the benefit that users could be more selective:
# def enumerable
# Enum.filter(value, fn(x) -> x.is_enum?)
# end
#
# (I know no Elixir. Be lenient.)
def value do
[nil, 0, 1.5, "Hello", {}]
end
# Proposal: Given yields to its block once
# for each value in the `given` lists.
describe "lists" do
given [l: empty_list] do
assert l.length = 0
given [v: value] do
when "I append a value" do
l = l.append(v)
assert l.last == v
assert l.length == 1
end
end
end
given [v1: value, v2: value] do
l = [v1, v2]
assert l.first == v1
assert l.last == v2
when "I reverse the list" do
l = l.reverse
assert l.first == v2
assert l.last == v1
end
end
end
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the proposed Elixir test syntax and the surrounding nine-comment discussion first; no implementation files, tests, or entry points are identified in the issue. Done would require an agreed syntax and a defined implementation scope, followed by corresponding framework tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100