Skip to content
This repository has been archived by the owner on Sep 14, 2024. It is now read-only.

.greater.than and .less.than #33

Open
Kampfkarren opened this issue Oct 8, 2018 · 5 comments
Open

.greater.than and .less.than #33

Kampfkarren opened this issue Oct 8, 2018 · 5 comments

Comments

@Kampfkarren
Copy link

Currently too unnatural to read:

expect(x > 0).to.equal(true)
@LPGhatguy
Copy link
Contributor

This falls apart once we consider >= and <= -- .greater.than.or.equal.to falls apart in the middle (or is a keyword)

@Kampfkarren
Copy link
Author

That's true, I forgot about >= and <=. Will readability have to suffer in favor of functionality?

greater_than, less_than
greater_than.or_equal_to, less_than.or_equal_to?

@LPGhatguy
Copy link
Contributor

I suspect the best solution to this problem will be to make camelCase versions of everything be the default or radically change the assertion syntax.

expect(x).toBeGreaterThan(3) seems fine, especially if we can preserve all of the flexibility of the current syntax?

@amoss-roblox
Copy link

#67

@ployt0
Copy link

ployt0 commented Feb 26, 2023

Currently too unnatural to read:

expect(x > 0).to.equal(true)

The assertion description is no good from this:

Expected value "true" (boolean), got "false" (boolean) instead

Plain assertions fare better. Simple numerical comparison should be a given; batteries included.

The argument about or can be avoided the same way we got around not being a keyword.

expect(x >= 0).to.equal(true)

is

expect(x).never.less.than(0)

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

No branches or pull requests

4 participants