Commit Graph

386 Commits

Author SHA1 Message Date
Alex Bramley dfb6f94b56 Manually managing deadlines is going to *suck*. 2012-02-04 01:12:41 +00:00
Alex Bramley b23215d09b Gofix run. 2012-02-04 00:51:06 +00:00
Alex Bramley be271308c9 Correct import path, again. 2012-02-03 23:48:20 +00:00
Alex Bramley 3387f6fb99 Correct import path. 2012-02-03 23:45:41 +00:00
Alex Bramley 01d58fc748 Update weekly to reflect the new location of gomock. 2012-02-03 23:13:00 +00:00
Alex Bramley fce8723af0 Basic copy test, to verify expected behaviour. 2011-12-06 00:21:57 +00:00
Alex Bramley f1d0dbe45a If client-side ping can be disabled, we need to ensure something absorbs the shutdown message. 2011-11-15 22:57:29 +00:00
Alex Bramley 3183c9f177 Allow client-side ping to be disabled by setting PingFreq to zero. 2011-11-15 22:22:40 +00:00
Alex Bramley 8fa5e5624e Fix issues/9 by implementing a client-side ping loop. 2011-11-15 22:17:29 +00:00
Alex Bramley e0a5a57fe1 Merge branch 'master' into weekly
Conflicts:
	client/connection.go  # MERGED
	event/registry.go     # DELETED
	logging/mock_test.go  # DELETED
2011-11-13 14:13:55 +00:00
Alex Bramley 907560b599 Migrate to split event pkg. 2011-11-13 14:07:19 +00:00
Alex Bramley 4e4c4b6798 Migrate to split logging pkg. 2011-11-13 14:02:12 +00:00
Alex Bramley 9d5159a220 gofix weekly fixes for client. 2011-11-13 13:34:32 +00:00
Alex Bramley 81eb9ee3df gofix weekly fixes for state. 2011-11-13 13:32:53 +00:00
Alex Bramley 0dc19703ab gofix weekly fixes for event. 2011-11-13 13:32:10 +00:00
Alex Bramley 3710f67670 gofix weekly fixes for logging. 2011-11-13 13:30:08 +00:00
Alex Bramley f62470c091 Test rateLimit(). Move call to time.After to write() for ease of testing.
Complete test coverage! Well, for things that matter. I think.
2011-11-11 11:17:18 +00:00
Alex Bramley dbc9c5f09d Misc minor fixen. 2011-11-11 10:49:33 +00:00
Alex Bramley 6a54622df9 Make mockNetConn more likely to expose racy conditions.
Use buffered channels so that Close() returns without waiting.
Use an array of three channels rather than appending to a slice.
2011-11-11 10:48:58 +00:00
Alex Bramley dc524420b0 Test write(). Fix bug where return of Flush() was not checked. 2011-11-11 10:17:17 +00:00
Alex Bramley 19ea7138e5 Test runLoop(). Needed a lot of sleeps... 2011-11-11 09:23:12 +00:00
Alex Bramley 9ccb0a39ab Test recv(). 2011-11-11 08:35:23 +00:00
Alex Bramley 0d4e83ea7f Fix length bug in mockNetChan.
Using the length of the provided buffer is dangerous after the first buffered
read from it, as it'll be the length of the buffer size...
2011-11-11 08:34:55 +00:00
Alex Bramley 38cd23891a Streamline timers in mockNetConn slightly. 2011-11-11 08:00:18 +00:00
Alex Bramley bfdd895ca6 Test send(). 2011-11-11 07:59:16 +00:00
Alex Bramley d4aceddcd7 Test Client creation and ST enable/disable. 2011-11-10 15:06:44 +00:00
Alex Bramley cab3d3da21 Fixes to gomock output so tests using mock pass. reflect.DeepEqual is picky. 2011-11-10 15:05:22 +00:00
Alex Bramley 80d8cd4ea7 Update README and example client once more. 2011-11-09 22:06:54 +00:00
Alex Bramley 8239bc4b6e Unit test adding and deleting handlers and events. 2011-11-09 21:54:14 +00:00
Alex Bramley 177149fd3c Remove lists when empty after deleting elements. 2011-11-09 21:38:47 +00:00
Alex Bramley bdb5c9b1a0 Squash a couple of bugs found by the unit tests. 2011-11-09 21:14:24 +00:00
Alex Bramley cdd08b2de8 Remove extraneous use of append in serialDispatch. 2011-11-09 20:30:37 +00:00
Alex Bramley a271cc06f3 Use mock dispatcher for testing event triggering. 2011-11-07 14:53:07 +00:00
Alex Bramley e04065dcbe Hmm, code generation failure 2011-11-07 13:53:50 +00:00
Alex Bramley d821d69f1c Add mock event registry. 2011-11-07 13:49:00 +00:00
Alex Bramley 3feaa7f302 Use a static map of event handlers for internal handlers too. 2011-11-07 13:44:03 +00:00
Alex Bramley aa75e0e0c6 Make enabling/disabling state-tracking easier. Improve constructors. 2011-11-07 13:34:13 +00:00
Alex Bramley 6e87169e2c Make API for adding/deleting handlers more coherent.
Previously, it was possible to add the same handler (as returned by NewHandler)
to multiple different event lists, but DelHandler only removed a handler from
*all* event lists it was present in. This may not be wanted behaviour, and
reduces control over the event lists.

Instead, allow both Add and DelHandler to take a variadic list of events to
add or delete handlers from.
2011-11-07 13:13:46 +00:00
Alex Bramley 4853024928 Nuke extraneous makefiles, no longer needed. 2011-11-06 06:26:59 +00:00
Alex Bramley caa9429a74 Update README. 2011-11-06 05:22:02 +00:00
Alex Bramley 2bc8238f8e Move state-related handlers to their own file for clarity. 2011-11-06 05:11:49 +00:00
Alex Bramley 2389f03d45 Update example client. 2011-11-06 05:08:28 +00:00
Alex Bramley 85097043cf Epic final commit for nick/chan/logging/testing refactor.
* Brings logging changes to client library.
* Brings state tracker to client library.
* Rewrites all tests to use mock logger and mock state tracker.
* Makes state tracking optional, finally.
* Shaves yaks until they are almost completely bald.
2011-11-06 04:56:46 +00:00
Alex Bramley 69d52270b6 Convert state tracker to use gomock logging for tests. 2011-11-05 12:22:04 +00:00
Alex Bramley d0f0175d7f Oops. Missed String() from interface. 2011-11-05 09:30:32 +00:00
Alex Bramley aa12177399 My mock is clunky for external use, but works well for internal testing. Switch to gomock. 2011-11-05 09:27:44 +00:00
Alex Bramley b1037b2603 Add String() method for stateTracker. 2011-11-05 06:06:59 +00:00
Alex Bramley fdba74e8c0 Shave the yaks in state's tests. 2011-11-05 06:06:40 +00:00
Alex Bramley 588a3168ac More logging yak-shaving:
* Change Mock API to match mockNetConn Expect* calls.
* Make logging.NewMock take and store *testing.T.
* Add a level-agnostic Expect().
* Make writerMap an externally accessible type.
* Adjust tests to take this shaving into account.
2011-11-05 05:56:45 +00:00
Alex Bramley cfffcf2a85 Add a method to wipe a state tracker clean. 2011-11-05 02:25:25 +00:00