Commit graph

10 commits

Author SHA1 Message Date
Michael Gratton
0ae633d88f Update existing tests to work with ValaUnit 2020-06-30 17:31:07 +10:00
Michael Gratton
c98efafb28 Fix failing test after test case async changes 2020-04-10 14:29:20 +10:00
Michael Gratton
196f05e595 test/test-case.vala: Rename TestCase async calls to match AsyncCallWaiter's 2020-04-10 12:58:09 +10:00
Michael Gratton
62f1df12cb Rework Geary.Imap.ClientConnection signal and error handling
Remove connect, disconnect and close_error signals, since they are
implied by their respective methods completing and/or throwing an
error. Remove Deserializer pass-through signals, treat all three kinds
as generic receive errors instead.

Make Deserializer emit end-of-stream signal only on EOS, not on EOS and
on receive error, so it only signals an error condition once.
2020-03-27 08:29:14 +11:00
Michael James Gratton
51b44f0f4b Remove ListParameter.parent property so lists can have multiple parents.
The ListParameter.parent property only existed to make the deserialier's
life easier, but is also why sketchy code was needed for appending search
criteria from a ServerSearchEmail replay op to the actual IMAP search
command sent to the server.

This removes the property altogether, and replaces its only use in
Deserialier with a stack, as nature intended. This means lists can be
added to more than one other list, and e.g. when a search is executed,
the search critera can be used for multiple requests.
2018-09-01 22:09:18 +10:00
Michael James Gratton
15748cef03 Tidy up unit test infrastructure and mock classes.
* test/api/*.vala: Renamed files that contained mock objects to *-mock.vala,
  not *-test.vala.

* test/testcase.vala: Renamed to test-case.vala for consistency, remove
  TestCase class from Gee package since that's really not true. Clean up
  code for consistency.

* test/meson.build, test/CMakeLists.txt: Split TestCase compilation out
  into a separate test lib.
2018-04-07 09:41:18 +10:00
Michael James Gratton
50f73ff252 Allow test fixtures and test methods to throw errors by default.
* test/testcase.vala (TestCase): Add a generic throws clause to both
  TestMethod and set_up and tear_down, update subclasses.
2018-04-07 09:41:18 +10:00
Michael James Gratton
9ac2b05a23 Ensure syntax errors are always reported by the deserialiser.
Add unit tests.

* src/engine/imap/transport/imap-deserializer.vala (Deserialiser): Add a
  new EOL even handler to the FAILED state that is the one place where
  the deserialize_failure() signal is fired and that any existing params
  are reset.
  (Deserialiser::push_line): Remove signal calls and unused return
  value. Don't use EOS to detect NUL to avoid some confusion. Ensure an
  EOL event is always fired so that the FAILED EOF handler is always run.
  (Deserialiser::push_data): Remove signal calls and unused return value.
  (Deserialiser::flush_params): Don't bother returning a state, since we
  now always know what the next one should be when calling it. Only
  trigger the parameters_ready() signal if there is a valid
  parameter. Make logging consistent with the rest of the class.
  (Deserialiser::reset_params): New common method for resetting any
  existing deserialised message.
  (Deserialiser::on_literal_char): Minor tidy up.
  (Deserialiser::on_eos): Ensure that any existing param is sent on EOS
  so that any BYE+EOS sent by the server is picked up.
2017-11-02 19:10:29 +11:00
Michael James Gratton
25e700d22a Allow IMAP atoms to be terminated by an atom-special w/o needing a space.
Fixes Bug 781488.

* src/engine/imap/transport/imap-deserializer.vala (Deserializer): Update
  char handling in START_PARAM state to be more explict and to handle all
  possible chars, not just a subset. Then, simply defer to START_PARAM to
  determine what to do when an invalid atom char is encountered when in
  the ATOM state. Rename SYSTEM_FLAG state to just FLAG since it also
  handles extension flags, and only use it for handling the first char in
  the flag so "\*" can be treated appropriately, then defer to the ATOM
  state, so flag keywords are treated in the same way as regular
  atoms. Add unit tests.
2017-11-02 19:10:29 +11:00
Michael James Gratton
bbcf57c8eb Add test case stub for Geary.Imap.Deserializer to the build. 2017-11-02 19:10:29 +11:00