-
-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError when to_object is passed null or undefined #518
Conversation
… is passed a 'null' or 'undefined' value
Codecov Report
@@ Coverage Diff @@
## master #518 +/- ##
==========================================
+ Coverage 68.06% 68.09% +0.02%
==========================================
Files 169 169
Lines 9918 9925 +7
==========================================
+ Hits 6751 6758 +7
Misses 3167 3167
Continue to review full report at Codecov.
|
I think I did this correctly, not sure why I'm getting a large red rectangle and it failed that check. Not finding any useful information.. Please let me know if there is something i need to change/fix. Best, |
This check is related to the test coverage of the code. We should add a test that checks that this works as expected. |
Ok! I will fix that tonight. |
@Razican I didn't find an existing to_object test, so I worte this test:
My only question is where to put it? in the test.rs file in the |
Yes. that is the best place. For the test I think it's best if we test that it's an #[test]
fn to_object() {
let realm = Realm::create();
let mut engine = Interpreter::new(realm);
assert!(engine.to_object(&Value::undefined()).unwrap_err().is_object());
assert!(engine.to_object(&Value::null()).unwrap_err().is_object());
} |
I think i messed something up... 😅 |
The rustfmt suggested i stagger the method chain... not sure if that looks any better.. but ok. o7
This Pull Request fixes/closes #483.
It changes the following:
to_object
implementation to throw aTypeError
when passed anundefined
ornull
value.Best,