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

Add in failing test case #1090

Merged
merged 2 commits into from
Nov 8, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,8 @@ class BaseGlobifier(dur: Duration, val sym: String, pattern: String, tz: TimeZon
// result <= rd
private def greatestLowerBound(rd: RichDate) = dur.floorOf(rd)
// rd <= result
private def leastUpperBound(rd: RichDate): RichDate = {
val lb = greatestLowerBound(rd)
if (lb == rd)
rd
else
lb + dur
}
private def leastUpperBound(rd: RichDate): RichDate =
greatestLowerBound(rd) + dur

def format(rd: RichDate) = rd.format(pattern)(tz)

Expand Down
30 changes: 16 additions & 14 deletions scalding-date/src/test/scala/com/twitter/scalding/DateTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,23 @@ class DateTest extends Specification {
"/2011/12/02/*", "/2011/12/03/*", "/2011/12/04/00")) ::
(t1.globify(DateRange("2011-12-01", "2011-12-01T23:59")),
List("/2011/12/01/*")) ::
(t1.globify(DateRange("2011-12-01T12", "2011-12-01T12:59")),
List("/2011/12/01/12")) ::
(t1.globify(DateRange("2011-12-01T12", "2011-12-01T14")),
List("/2011/12/01/12", "/2011/12/01/13", "/2011/12/01/14")) ::
(t2.globify(DateRange("2011-12-01T14", "2011-12-04")),
List("/2011/12/01/", "/2011/12/02/", "/2011/12/03/", "/2011/12/04/")) ::
(t2.globify(DateRange("2011-12-01", "2011-12-01T23:59")),
List("/2011/12/01/")) ::
(t2.globify(DateRange("2011-12-01T12", "2011-12-01T12:59")),
(t1.globify(DateRange("2014-06-30T00", "2014-07-01T00")),
List("/2014/06/30/*", "/2014/07/01/00")) ::
(t1.globify(DateRange("2011-12-01T12", "2011-12-01T12:59")),
List("/2011/12/01/12")) ::
(t1.globify(DateRange("2011-12-01T12", "2011-12-01T14")),
List("/2011/12/01/12", "/2011/12/01/13", "/2011/12/01/14")) ::
(t2.globify(DateRange("2011-12-01T14", "2011-12-04")),
List("/2011/12/01/", "/2011/12/02/", "/2011/12/03/", "/2011/12/04/")) ::
(t2.globify(DateRange("2011-12-01", "2011-12-01T23:59")),
List("/2011/12/01/")) ::
(t2.globify(DateRange("2011-12-01T12", "2012-01-02T14")),
List("/2011/12/*/", "/2012/01/01/", "/2012/01/02/")) ::
(t2.globify(DateRange("2011-11-01T12", "2011-12-02T14")),
List("/2011/11/*/", "/2011/12/01/", "/2011/12/02/")) ::
Nil
(t2.globify(DateRange("2011-12-01T12", "2011-12-01T12:59")),
List("/2011/12/01/")) ::
(t2.globify(DateRange("2011-12-01T12", "2012-01-02T14")),
List("/2011/12/*/", "/2012/01/01/", "/2012/01/02/")) ::
(t2.globify(DateRange("2011-11-01T12", "2011-12-02T14")),
List("/2011/11/*/", "/2011/12/01/", "/2011/12/02/")) ::
Nil

testcases.foreach { tup =>
tup._1 must_== tup._2
Expand Down