Closed Bug 365212 Opened 13 years ago Closed 13 years ago

Use xpcshell based unit test framework


(Calendar :: Internal Components, defect)

Not set


(Not tracked)



(Reporter: mvl, Assigned: mvl)



(2 files)

We have a calendar/test directory, with some js based tests in there. But I don't think they really work.
If we switch to the xpcshell based unit test framework, the one in mozilla/tools/test-hardness, we can make tests more easily. It does include an eventloop, so we can test async providers. It also integrates with the build system, so we can make tinderboxes go orange on failed tests.
We can't make tinderbox run the tests just yet, because we use the tinderboxes also for distributing builds: bug 351968.
Assignee: nobody → mvl
Attached patch makefile changesSplinter Review
This patch changes the makefiles such that unit tests can be added to calendar/test/unit, as described in
Attachment #249882 - Flags: first-review?(dmose)
Attached patch firsts testsSplinter Review
Those first tests are partly conversions from the existing tests in test/homegrown/misc. Some came from libical/test-data/recur.txt. And I just made up some others.
Attachment #249887 - Flags: first-review?(jminta)
Comment on attachment 249887 [details] [diff] [review]
firsts tests

+++ test/unit/test_attendee.js	2006-12-28 11:41:18.000000000 +0100
+    // Create event
+    var event = eventClass.createInstance(eventIID);
Can you move this down closer to where it's actually going to be used?

+function findById(event, id, a) {
+    var foundAttendee = event.getAttendeeById(id);
+    do_check_eq(foundAttendee, a);
Do we need to be concerned about the wrapping problems we encounter elsewhere in the code?

+++ test/unit/test_datetime.js	2006-12-27 23:44:15.000000000 +0100

+  cd.timezone = "/";
+  cd.normalize();
+  do_check_eq(cd.hour, 10);
+  do_check_eq(cd.icalString, "20051113T100000");
Why does icalString not include TZID= ?

+++ test/unit/test_ics_roundtrip.js	2006-12-28 16:09:01.000000000 +0100

+function checkRoundtrip(expectedProps, obj) {
+    for (var key in expectedProps) {
+        // Need translation
+        icskey = key;
Strict warning, and the comment should probably be a bit more verbose.

r=jminta with that.
Attachment #249887 - Flags: first-review?(jminta) → first-review+
(In reply to comment #4)
> Why does icalString not include TZID= ?

Because the tzid is a parameter, and not part of the property value (in rfc2445 speak).
Yes, it is confusing, and i'm not sure what to do about it.
Attachment #249882 - Flags: first-review?(dmose)
I think this can go in now.  I suspect dmose won't be maintaining his old tests anyway :)
Per our calendar-qa phone conference meeting today, we've landed these patches.
The old tests were left until we can confirm with dmose that they're okay to delete.

Closed: 13 years ago
Resolution: --- → FIXED
Flags: in-testsuite+
Version: Trunk → unspecified
You need to log in before you can comment on or make changes to this bug.