Skip to content

Commit

Permalink
[Truffle] Add time stdlib to specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Apr 18, 2015
1 parent 06c5d29 commit 709766f
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions spec/truffle/tags/library/time/httpdate_tags.txt
@@ -0,0 +1 @@
fails:Time.httpdate parses RFC-2616 strings
1 change: 1 addition & 0 deletions spec/truffle/tags/library/time/iso8601_tags.txt
@@ -0,0 +1 @@
fails:Time.xmlschema parses ISO-8601 strings
2 changes: 2 additions & 0 deletions spec/truffle/tags/library/time/rfc2822_tags.txt
@@ -0,0 +1,2 @@
fails:Time.rfc2822 parses RFC-822 strings
fails:Time.rfc2822 parses RFC-2822 strings
2 changes: 2 additions & 0 deletions spec/truffle/tags/library/time/rfc822_tags.txt
@@ -0,0 +1,2 @@
fails:Time.rfc822 parses RFC-822 strings
fails:Time.rfc822 parses RFC-2822 strings
1 change: 1 addition & 0 deletions spec/truffle/tags/library/time/xmlschema_tags.txt
@@ -0,0 +1 @@
fails:Time.xmlschema parses ISO-8601 strings
1 change: 1 addition & 0 deletions spec/truffle/truffle.mspec
Expand Up @@ -100,6 +100,7 @@ class MSpecScript
"spec/ruby/library/stringio",
"spec/ruby/library/tempfile",
"spec/ruby/library/thread",
"spec/ruby/library/time",
"spec/ruby/library/tmpdir",
"spec/ruby/library/uri",

Expand Down
Expand Up @@ -56,8 +56,14 @@ public InternalSetGMTNode(InternalSetGMTNode prev) {
}

@Specialization
public boolean internalSetGMT(RubyTime time, Object setGMT) {
throw new UnsupportedOperationException("_set_gmt" + setGMT.getClass());
public boolean internalSetGMT(RubyTime time, boolean isGMT) {
if (isGMT) {
time.setDateTime(time.getDateTime().withZone(DateTimeZone.UTC));
} else {
// Do nothing I guess - we can't change it to another zone, as what zone would that be?

This comment has been minimized.

Copy link
@nirvdrum

nirvdrum Apr 19, 2015

Contributor

Would it be better to raise an exception of some sort so we know when this state is hit, if it shouldn't ever be hit?

This comment has been minimized.

Copy link
@chrisseaton

chrisseaton Apr 19, 2015

Author Contributor

Yes I should do that. The underlying problem is that there are two variables @offset and @is_gmt, and I have no idea how those two interact. What if offset is 10 but it's also flagged as being GMT?

}

return isGMT;
}
}

Expand Down

0 comments on commit 709766f

Please sign in to comment.