Comments (7)
@matchai Funny story. Fishtape 1 didn't have this either. Your tests will pass even if the next condition fails.
from fishtape.
@jorgebucaran Oh... That's a shock. 😳
I guess I'll be quickly updating my tests in that case.
from fishtape.
@matchai What happens if the expression fails—how do we report that with TAP?
Here is an alternative. Print the $status
right after running mock
:
@test "It should not mock blacklisted elements" (
echo (
mock eval \*
echo $status
)
) = "The function \"eval\" is reserved and therefore cannot be mocked. 0"
We need to wrap mock
and echo $status
in another echo
to remove new lines.
Here is another idea: If you check the exit status often, create a utility function to echo stdout if $staus
is 0
.
function only_if_ok
and echo "$argv"; or echo
end
@test "It should not mock blacklisted elements" (
only_if_ok (mock eval \*)
) = "The function \"eval\" is reserved and therefore cannot be mocked."
from fishtape.
What happens if the expression fails—how do we report that with TAP?
I think the ideal thing would be to support subtests. Though they have never been standardized in TAP, they're commonly used. (TestAnything/Specification#2)
Both solid suggestions! I'll try them out. 👍
from fishtape.
@matchai I disagree.
I'm not opposed to subtests (see below), but I am positive that using conditional operators (-a
or -o
) to describe them would be the wrong tool for the job.
Now, how do we describe subtests using our limited syntax (jorgebucaran/fishtape#34)?
Here's an idea that doesn't rely on syntax:
fishtape parent_test.fish
# Parent
# Child
# Grandchild
ok 1 - some foo test
ok 2 - some bar test
not ok 3 - some baz test
not ok 3 - some baz test
---
operator: =
expected: bar
actual: baz
...
1..3
# tests 3
# pass 2
# fail 1
ok 1 - grandchild_test.fish
1..1
# tests 1
# fail 1
ok 1 - child_test.fish
1..1
# tests 1
# fail 1
ok 1 - parent_test.fish
1..1
# tests 1
# fail 1
parent_test.fish
@mesg "Parent"
fishtape child_test.fish
child_test.fish
@mesg "Child"
fishtape granchild_test.fish
grandchild_test.fish
@mesg "Grandchild"
test "some foo test" foo = foo
test "some bar test" bar = bar
test "some baz test" bar = baz
Closing as I won't be implementing conditional operators at this time, but we can discuss subtests in a separate issue.
from fishtape.
I am positive that using conditional operators (
-a
or-o
) to describe them would be the wrong tool for the job
Oh yeah, absolutely. I was just thinking that having multiple test cases share the same setup would be best done with subtests. If it would be possible for tests to inherit their parents' setup, that would make -a
or -o
unnecessary.
from fishtape.
@matchai Ah, I see what you mean then. Glad we're clear about that.
from fishtape.
Related Issues (20)
- Missing end to balance this function definition HOT 1
- Conditional test not running HOT 3
- Files not included in tab completions
- isatty is always 1 in tests
- Feature Request: oh-my-fish support HOT 1
- When a test fails fishtape return status 0 instead of 1
- Doesn't print report properly on Alpine Linux HOT 2
- Measure code coverage HOT 2
- How to debug? HOT 1
- Fishtape 3
- Exclude test file HOT 4
- Migrating from V2 to V3 HOT 4
- test vs tests for directory name HOT 5
- actual and expected
- Detect errors HOT 14
- Option to stylize output HOT 2
- Only try to execute all fish files found as tests HOT 3
- No way to specify fish arguments HOT 5
- feature request: before_each and after_each hooks HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fishtape.