Skip to content

Fix for issue 725 casts on numeric references types causing exceptions#729

Open
opeongo wants to merge 2 commits intomasterfrom
fixCast_725
Open

Fix for issue 725 casts on numeric references types causing exceptions#729
opeongo wants to merge 2 commits intomasterfrom
fixCast_725

Conversation

@opeongo
Copy link
Contributor

@opeongo opeongo commented Feb 27, 2023

No description provided.

@opeongo opeongo mentioned this pull request Feb 27, 2023
@codecov
Copy link

codecov bot commented Feb 27, 2023

Codecov Report

Attention: Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 74.23%. Comparing base (b1998b1) to head (4e8d9dd).
Report is 1062 commits behind head on master.

Files with missing lines Patch % Lines
src/main/java/bsh/Types.java 33.33% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #729      +/-   ##
============================================
- Coverage     74.24%   74.23%   -0.02%     
- Complexity     3041     3044       +3     
============================================
  Files           108      108              
  Lines          9354     9360       +6     
  Branches       1857     1860       +3     
============================================
+ Hits           6945     6948       +3     
  Misses         2070     2070              
- Partials        339      342       +3     
Flag Coverage Δ
unittests 74.23% <33.33%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nickl-
Copy link
Member

nickl- commented Apr 1, 2023

Looks good but we are loosing too much code coverage. Please add tests for the other paths too:

Some or all of these conditions are missing:

fromType == null
fromType.isPrimitive()
!toType.isAssignableFrom( fromType )
checkOnly == true

I know it is getting harder to maintain or even improve on the overall coverage, but the unit tests only cover a 3rd of this patch.

@opeongo
Copy link
Contributor Author

opeongo commented May 29, 2023

Looks good but we are loosing too much code coverage. Please add tests for the other paths too:

Some or all of these conditions are missing:

fromType == null
fromType.isPrimitive()
!toType.isAssignableFrom( fromType )
checkOnly == true

I know it is getting harder to maintain or even improve on the overall coverage, but the unit tests only cover a 3rd of this patch.

It is not easy to write tests for all of these conditions. For example, how to I write a test for checkOnly when it is not exposed to the scripting environment?

@nickl-
Copy link
Member

nickl- commented Aug 10, 2024

It is not easy to write tests for all of these conditions. For example, how to I write a test for checkOnly when it is not exposed to the scripting environment?

Surely we can write a test with the appropriate conditions to cover the condition without it being specifically exposed to the scripting environment. If we can't cover it then why is it implemented then, perhaps then we don't need the condition?

@opeongo
Copy link
Contributor Author

opeongo commented Aug 10, 2024

It is not easy to write tests for all of these conditions. For example, how to I write a test for checkOnly when it is not exposed to the scripting environment?

Surely we can write a test with the appropriate conditions to cover the condition without it being specifically exposed to the scripting environment. If we can't cover it then why is it implemented then, perhaps then we don't need the condition?

My guess is that the code is there as a sanity check to ensure that the contract is being met. It would take a lot of auditing to make sure that those tests can be safely removed.

I have no more tests to add for this one that will cover those existing code paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants