Skip to content
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

Test of expression "Today at" fail #125

Closed
WeeskyBDW opened this issue Nov 24, 2021 · 3 comments · Fixed by #127
Closed

Test of expression "Today at" fail #125

WeeskyBDW opened this issue Nov 24, 2021 · 3 comments · Fixed by #127

Comments

@WeeskyBDW
Copy link
Contributor

WeeskyBDW commented Nov 24, 2021

👋
i was working on #119 (yes the PR isn't dead lol) and a new test error was throw to me by skript-parser. Test who throw the error is ExprDateTodayAt. After a bit of tests, it appear that it do this only between 0:00 and 1:00 (12am and 1am)

How to reproduct:
set your computer hour to 0:35 for example
run unit tests (gradlew test)

skript-parser version: from master branch
Java version: 11.8.0
Error:

SyntaxParserTest > syntaxTest() > expressions > io.github.syst3ms.skriptparser.parsing.SyntaxParserTest.syntaxTest()[2][26] FAILED
    java.lang.AssertionError: Days of {now} and {today} are not equal: 24 != 25 (respectively) (ExprDateTodayAt.txt)
        at io.github.syst3ms.skriptparser.syntax.EffAssert.lambda$execute$1(EffAssert.java:71)
        at java.base/java.util.Optional.ifPresent(Optional.java:183)
        at io.github.syst3ms.skriptparser.syntax.EffAssert.execute(EffAssert.java:71)
        at io.github.syst3ms.skriptparser.lang.Effect.run(Effect.java:14)
        at io.github.syst3ms.skriptparser.lang.Statement.walk(Statement.java:72)
        at io.github.syst3ms.skriptparser.lang.Statement.lambda$runAll$0(Statement.java:92)
        at java.base/java.util.Optional.flatMap(Optional.java:294)
        at io.github.syst3ms.skriptparser.lang.Statement.runAll(Statement.java:92)
        at io.github.syst3ms.skriptparser.TestAddon.finishedLoading(TestAddon.java:31)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
        at io.github.syst3ms.skriptparser.parsing.SyntaxParserTest.lambda$syntaxTest$4(SyntaxParserTest.java:62)

Edit: this seem to be a know bug, according to the test code. No way to fix that ?

@Mwexim
Copy link
Owner

Mwexim commented Nov 25, 2021

This is caused by the SkriptParser class. For the today() method, it takes the ZONE_ID static field into account (which is Greenwich Mean Time for all tests). For the now() method though, the system time zone is used.

I assume you live in the GMT+1 region somewhere, which is the reason this fails for you between 12PM and 1AM.

@WeeskyBDW
Copy link
Contributor Author

WeeskyBDW commented Nov 25, 2021

I live in France so yes. No way to fix this ?

@Mwexim
Copy link
Owner

Mwexim commented Nov 25, 2021

I live in France so yes. No way to fix this ?

There is an easy fix, working on it as we speak.

@Mwexim Mwexim mentioned this issue Dec 9, 2021
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 a pull request may close this issue.

2 participants