atrium's block syntax can do better but `property(...
# test
k
atrium's block syntax can do better but
property(subject::x).toBe(...)
is a lot of extra words.
d
You can always discuss your ideas with @robstoll, the author on #atrium , he's very friendly, open to ideas (and PRs 🙂). It's really a great library, and I think you could always define your own grammar to make this shorter.
r
@keturn If I understand you correctly you say "atrium's block can do better" which I interpret as better than others, right? Or do you miss something? I don't know PowerAssert for JavaScript but I guess it is expression tree based meaning you can do something like:
Copy code
assert(Person("robert")) {
   name == "robert"
}
Instead of
Copy code
assert(Person("robert")){
  property(subject::name).toBe("robert")
}
Right?
I will most likely switch to a shorter syntax either already in 0.8.0 or in 0.9.0 which will look as follows:
Copy code
assert(Person("robert")) {
   property { ::name }.toBe("robert")
}
And of course, you could add an alias for property, say
p
which makes it look like:
Copy code
assert(Person("robert")) {
   p { ::name }.toBe("robert")
}
Or on one line
Copy code
assert(Person("robert")).p { ::name }.toBe("robert")
And in case you prefer infix style:
Copy code
assert(Person("robert")) p { ::name } toBe "robert"
Which comes close to the syntax of PowerAssert. If we could overload
==
in Kotlin I could provide something which resembles it even more.
k
⤴️ moving to #atrium