-
Notifications
You must be signed in to change notification settings - Fork 44
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
fix(stdlib): fix uninitialized type casing #598
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Puritanic — thanks for the PR! You're right, something's definitely not correct in brs
. Looks like there's a little more work to align with the print variableThatDoesNotExist
output in the reference implementation, but this is a fantastic start. Thanks for all your effort so far!
Co-authored-by: Sean Barag <[email protected]>
Co-authored-by: Sean Barag <[email protected]>
I'll try to fix this today (if I have time) 👍 |
* upstream/main: doc: Add table of scenegraph node statuses (sjbarag#607) v0.41.0 (sjbarag#605) feat(execution): create function to execute with scope (sjbarag#603) fix(stdlib): callFunc should always return a value (sjbarag#604) feat(rsg): Add isSubtype() and parentSubtype() functions to RoSGNode (sjbarag#584) doc: Link to NotImplemented.md in README doc: Remove project maturity concession doc: List unsupported BrightScript components, functions, and statements
@sjbarag I've fixed tests and refactored code based on suggestions you've provided, I hope that everything is okay now. FYI, I'm getting some weird issues when running tests locally: Summary of all failing tests
FAIL test/brsTypes/components/RoDateTime.test.js
● RoDateTime › methods › getLastDayOfMonth › returns the date/time value's last day of the month
expect(received).toEqual(expected) // deep equality
- Expected - 1
+ Received + 1
Int32 {
"kind": 4,
- "value": 31,
+ "value": 30,
}
210 | let result = getLastDayOfMonth.call(interpreter);
211 | expect(getLastDayOfMonth).toBeTruthy();
> 212 | expect(result).toEqual(new Int32(31));
| ^
213 | });
214 | });
215 |
at Object.toEqual (test/brsTypes/components/RoDateTime.test.js:212:32)
at processTicksAndRejections (node:internal/process/task_queues:93:5)
FAIL test/e2e/BrsComponents.test.js (5.228 s)
● end to end brightscript functions › components/roDateTime.brs
expect(received).toEqual(expected) // deep equality
- Expected - 1
+ Received + 1
@@ -20,11 +20,11 @@
"Minutes: ",
"14",
"Seconds: ",
"15",
"Last Day of Month: ",
- "30",
+ "29",
"Milliseconds: ",
"160",
"ISO String UTC: ",
"2010-11-12T13:14:15Z",
]
81 | await execute([resourceFile("components", "roDateTime.brs")], outputStreams);
82 |
> 83 | expect(allArgs(outputStreams.stdout.write).filter((arg) => arg !== "\n")).toEqual([
| ^
84 | "Full Date: ",
85 | "Friday November 12, 2010",
86 | "No Week Day: ",
at Object.toEqual (test/e2e/BrsComponents.test.js:83:83) These two tests are failing when I run the |
Those are both date/time-based issues! Github reports your location as Serbia, so I wouldn't be surprised if our tests are a little flaky — most contributors are in UTC-7 / UTC-4, and the GitHub Actions runners probably use UTC as their timezone. In fact, I'm able to reproduce that failure by running tests with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates, @Puritanic! I really appreciate the effort you've put in 😄
This MR fixes the casing of the
<uninitialized>
brightscript type, and is related to this issue #482Apparently, when we try to compare the type of some value to
"<UNINITIALIZED>"
in Brightscript running on Roku devices, it's causing the channel executing that code to crash, as it seems that this should be in all lowercase, which is working as expected.The problem I'm having with this is that we have some tests which are running in
brs
and in those tests we're testing a util function which is checking if the value is valid and defined:If I test this function in brs like this:
This returns
true
, which is not correct, but If I change the above function to check for"<UNINITIALIZED>"
instead it returns the correctresult
which isfalse
. The problem is that"<UNINITIALIZED>"
is not the correct type and I can't refactor the function above to check for it as it's gonna cause a crash for my app.That being said, I'm not sure if there is a particular reason why is this named
"<UNINITIALIZED>"
, first time contributing to this project.fixes #482