[p5.js 2.0+ Bug Report]: Missing unit tests for isLooping() return value
Most appropriate sub-area of p5.js?
- [ ] Accessibility
- [ ] Color
- [x] Core/Environment/Rendering
- [ ] Data
- [ ] DOM
- [ ] Events
- [ ] Image
- [ ] IO
- [ ] Math
- [ ] Typography
- [ ] Utilities
- [ ] WebGL
- [ ] WebGPU
- [ ] p5.strands
- [ ] Build process
- [x] Unit testing
- [ ] Internationalization
- [ ] Friendly errors
- [ ] Other (specify if possible)
p5.js version
current main (5743cb5ba)
Web browser and version
N/A — test coverage gap, not a runtime bug
Operating system
N/A — same reason
Steps to reproduce this
isLooping() (src/core/structure.js) returns the internal _loop flag and is
documented in its JSDoc as supported usage — but its return value is never
tested. There are currently zero references to isLooping anywhere under
test/; the existing loop()/noLoop() suite in
test/unit/core/structure.js asserts only on frameCount behavior and never
calls isLooping().
Proposed tests (test-only, no source changes):
isLooping()returnstrueby default while the draw loop is running- returns
falseafternoLoop() - returns
trueagain after a subsequentloop()
I'd like to fix this myself if approved.
Thanks for reporting this @harshiltewari2004 ! It looks like a valid test coverage gap since isLooping() is part of the public API, having direct unit test for its behavior will be useful. The proposed test cases for the default state, noLoop(), and loop() again all make sense for covering its expected behavior.
I've assigned this to you, feel free to work on it. Looking forward to the PR!
cc @davepagurek @ksen0
Thanks @aashu2006! I'll follow the conventions of the existing structure.js test suite and put up a PR soon!