Skip to content
This repository has been archived by the owner on Jan 21, 2023. It is now read-only.

Allow functions for actual and expected? #3

Open
perguth opened this issue Dec 18, 2016 · 5 comments
Open

Allow functions for actual and expected? #3

perguth opened this issue Dec 18, 2016 · 5 comments
Labels

Comments

@perguth
Copy link
Owner

perguth commented Dec 18, 2016

Nice for grouping and namespacing purposes I would imagine.

For test methods with arity of 1

Eg t.ok:

'Something more elaborate'.ok(x => {
  // introduce (block) scoped variables etc...
  return someValue
})

For test methods with arity of 2

Eg t.equal:

'Something more elaborate'.equal(x => {
  // introduce (block) scoped variables etc...
  return someValue
}, x => {
  // introduce (block) scoped variables etc...
  return someValue
})
@perguth perguth changed the title Allow functions for actual and expected Allow functions for actual and expected? Dec 18, 2016
@ljharb
Copy link

ljharb commented Apr 16, 2017

how would that work with function foo() {}; foo.equals(foo)

@fentas
Copy link

fentas commented Apr 17, 2017

You could do function foo() {}; 'foo equals foo'.equals(foo, foo).
Currently tapes test methods are only attached to the String prototype.

@perguth
Copy link
Owner Author

perguth commented Apr 17, 2017

Ah, I see. By introducing that feature we would loose the ability to check functions for equality (case: "For test methods with arity of 2").

@perguth
Copy link
Owner Author

perguth commented Apr 17, 2017

Anyway, what this points out is that we would break the expectation regarding tapes behaviour. I guess this is a close!?

@ljharb
Copy link

ljharb commented Apr 17, 2017

More to the point, you'd either lose the ability to ever pass a non-function, or, you'd have your API be wildly different just for function subjects.

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

No branches or pull requests

3 participants