[Gnucash-changes] r13716 - gnucash/trunk/src - factor out grammar check, add tests.

Josh Sled jsled at asynchronous.org
Fri Mar 31 09:32:35 EST 2006


On Thu, 2006-03-30 at 20:21 -0500, Chris Shoemaker wrote:
> On Thu, Mar 30, 2006 at 07:03:55PM -0500, Josh Sled wrote:
> > On Thu, 2006-03-30 at 16:28 -0500, Chris Shoemaker wrote:
> > > value, but please let it print FAILED.
> > 
> > While it would be nice if our test framework supported tests known not
> > to pass, it doesn't.  
> 
> But it does.  Just call do_test().  If the test fails, it will print
> FAILURE, but it will still pass 'make check'.  We have tests that do
> this now.  They just don't end with 'exit(get_rv())'.  However, it's
> trivial to change get_rv() to return the number of failures, allowing
> a test with known failures to end with, e.g.  'exit(get_rv() > 2)'

Oh, so it does.  I'd rather have an expliclit
'add_fail_test_known_to_pass' (and vice-versa).  I'm opposed to
returning and testings against the failure count, since those counted
might be entirely different from the ones being expected.



> Ok, I guess "a 0" was failing for a different reason then.  But, I
> confirm that you've fixed it.  I can't get any random numbers out of
> the parser any more.  (It doesn't even seem possible to enter quotes.)
> Nice job!  Thanks for fixing this.

The register (pricecell) doesn't admit quotes in the simpler
'modify-verify' check of the string.  The quotes are only used for the
formula-based expressions, and are quoted specifically to be tokenized
as strings rather than variables.  "a 0" parses as [VAR_TOKEN{'a'},
(space,) NUM_TOKEN{0}].

I'm hoping we can have an actual grammar-based parser post-2.0.

> BTW, it looks like you're also adding an additional error state to the
> parser.  Is that with a view toward being able to report the error in
> the register?

None of the existing error codes fit, really, so I needed to add the new
state.  But, yes, I am looking into Bug#119078 and bubbling the errors
up to the user.

The problems right now are:

1/ The register/cell design doesn't allow the cell-leave callback to
prevent leaving a cell, so all we can do (easily) is warn-dialog the
user and leave the value as-is.  I'm find with this, as it's better than
before.

2/ On the last pricecell in the register row, cell-leave is called 3
times, from:
  - sheet cursor_move/deactivate_cursor_cell
  - split_register_save
  - split_register load
In all cases, it's gnc_table_leave_update that's being called and thus
calling the cell-leave handler.

Anyways, that's where I stopped last night... hopefully I'll figure out
something later today.

-- 
...jsled
http://asynchronous.org/ - `a=jsled; b=asynchronous.org; echo ${a}@${b}`


More information about the gnucash-devel mailing list