Use xpcshell based unit test framework

VERIFIED FIXED

Status

Calendar
Internal Components
VERIFIED FIXED
12 years ago
11 years ago

People

(Reporter: Michiel van Leeuwen (email: mvl+moz@), Assigned: Michiel van Leeuwen (email: mvl+moz@))

Tracking

unspecified
Bug Flags:
in-testsuite +

Details

Attachments

(2 attachments)

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.
(Assignee)

Comment 1

12 years ago
We can't make tinderbox run the tests just yet, because we use the tinderboxes also for distributing builds: bug 351968.
(Assignee)

Updated

12 years ago
Assignee: nobody → mvl
(Assignee)

Comment 2

12 years ago
Created attachment 249882 [details] [diff] [review]
makefile changes

This patch changes the makefiles such that unit tests can be added to calendar/test/unit, as described in http://developer.mozilla.org/en/docs/Writing_xpcshell-based_unit_tests
Attachment #249882 - Flags: first-review?(dmose)
(Assignee)

Comment 3

12 years ago
Created attachment 249887 [details] [diff] [review]
firsts tests

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.
(Assignee)

Updated

12 years ago
Attachment #249887 - Flags: first-review?(jminta)

Comment 4

12 years ago
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 = "/mozilla.org/20050126_1/America/Bogota";
+  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+
(Assignee)

Comment 5

12 years ago
(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.

Updated

12 years ago
Attachment #249882 - Flags: first-review?(dmose)
mvl:
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.

-> FIXED
Status: NEW → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
Flags: in-testsuite+
Version: Trunk → unspecified
You need to log in before you can comment on or make changes to this bug.