This is the mail archive of the mauve-patches@sources.redhat.com mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] mauve testsuite sql Timestamp


Hi,

On Sun, 2004-10-10 at 18:22, Andreas Tobler wrote:
> > I do this just before I create a new timestamp:
> > 
> >     // Set a common timezone to get the same result everywhere.
> >     SimpleTimeZone stz = new SimpleTimeZone(0 * 3600, "GMT");
> >     TimeZone.setDefault(stz);
>
> with the attached patch it seems to werk and hopefully also for all 
> people not sitting in my timezone :)

Thanks. Looks good and works for me.
Committed as:

2004-10-10  Andreas Tobler <toa@pop.agri.ch>

        * gnu/testlet/java/sql/Timestamp/TimestampTest.java: Set default
        TimeZone before the tests.

BTW. There is a mauve-patches@sources.redhat.com mailinglist (CCed).

Cheers,

Mark
> 
> ______________________________________________________________________
> Index: gnu/testlet/java/sql/Timestamp/TimestampTest.java
> ===================================================================
> RCS file: /cvs/mauve/mauve/gnu/testlet/java/sql/Timestamp/TimestampTest.java,v
> retrieving revision 1.2
> diff -u -r1.2 TimestampTest.java
> --- gnu/testlet/java/sql/Timestamp/TimestampTest.java	15 Jul 2004 20:58:41 -0000	1.2
> +++ gnu/testlet/java/sql/Timestamp/TimestampTest.java	10 Oct 2004 16:20:00 -0000
> @@ -27,11 +27,18 @@
>  
>  import java.sql.*;
>  
> +import java.util.SimpleTimeZone;
> +import java.util.TimeZone;
> +
>  public class TimestampTest implements Testlet
>  {
>    public void
>    test(TestHarness harness)
>    {
> +     // Set a common timezone to get the same result everywhere.
> +    SimpleTimeZone stz = new SimpleTimeZone(-5 * 1000 * 3600, "GMT");
> +    TimeZone.setDefault(stz);
> +
>      try {
>        Timestamp.valueOf("NoSuchTime");
>        harness.check(false, "valueOf");
> @@ -40,24 +47,35 @@
>        harness.check(true, "valueOf");
>      }
>  
> +
>      Timestamp ts = new Timestamp(1099999999333L);
>      harness.check(ts.getNanos() == 333000000, "getNanos");
>      harness.check(ts.toString().equals("2004-11-09 06:33:19.333"),
>                    "toString");
> +    harness.debug(ts.toString());
>  
>      ts.setNanos(42);
>      harness.check(ts.getNanos() == 42, "getNanos");
>      harness.check(ts.toString().equals("2004-11-09 06:33:19.000000042"),
>                    "toString");
>  
> +    harness.debug(ts.toString());
> +
>      ts.setNanos(0);
>      harness.check(ts.getNanos() == 0, "getNanos");
>      harness.check(ts.toString().equals("2004-11-09 06:33:19.0"),
>                    "toString");
> -    
> +
> +    harness.debug(ts.toString());
> +
>      Timestamp ts2 = new Timestamp(1099999999999L);
>      harness.check(ts.equals(ts2) == false, "equals");
>      ts.setNanos(999000000);
>      harness.check(ts.equals(ts2), "equals");
> +
> +    harness.debug(ts.toString());
> +    
> +    // Restore Timezone
> +    TimeZone.setDefault(null);
>    }
>  }

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]