[Gnucash-changes] r13490 - gnucash/trunk - Fix test errors, then failures.

Joshua Sled jsled at cvs.gnucash.org
Sun Mar 5 13:33:35 EST 2006


Author: jsled
Date: 2006-03-05 13:33:34 -0500 (Sun, 05 Mar 2006)
New Revision: 13490
Trac: http://svn.gnucash.org/trac/changeset/13490

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/app-utils/test/test-exp-parser.c
   gnucash/trunk/src/calculation/expression_parser.c
Log:
Fix test errors, then failures.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-03-05 15:40:33 UTC (rev 13489)
+++ gnucash/trunk/ChangeLog	2006-03-05 18:33:34 UTC (rev 13490)
@@ -1,3 +1,14 @@
+2006-03-05  Joshua Sled  <jsled at asynchronous.org>
+
+	* src/app-utils/test/test-exp-parser.c (test_parser): Hack-fix
+	test errors due to missing function now required by
+	expression-parser.  In the future, we should have a better way to
+	setup the application/test state.
+
+	* src/calculation/expression_parser.c (primary_exp): Fix
+	function-parsing bug I introduced during the week with another bug
+	fix.
+
 2006-03-05  Derek Atkins  <derek at ihtfp.com>
 
 	* src/register/ledger-core/split-register.c:

Modified: gnucash/trunk/src/app-utils/test/test-exp-parser.c
===================================================================
--- gnucash/trunk/src/app-utils/test/test-exp-parser.c	2006-03-05 15:40:33 UTC (rev 13489)
+++ gnucash/trunk/src/app-utils/test/test-exp-parser.c	2006-03-05 18:33:34 UTC (rev 13490)
@@ -150,7 +150,10 @@
                  "- 42.72 + 13.32 + 15.48 + 23.4 + 115.4",
                  gnc_numeric_create(35897, 100) );
 
+  scm_c_eval_string("(define (gnc:error->string tag args)   (define (write-error port)     (if (and (list? args) (not (null? args)))         (let ((func (car args)))           (if func               (begin                 (display \"Function: \" port)                 (display func port)                 (display \", \" port)                 (display tag port)                 (display \"\n\n\" port)))))     (false-if-exception      (apply display-error (fluid-ref the-last-stack) port args))     (display-backtrace (fluid-ref the-last-stack) port)     (force-output port))   (false-if-exception    (call-with-output-string write-error)))");
+
   scm_c_eval_string( "(define (gnc:plus a b) (+ a b))" );
+  add_pass_test("plus(2 : 1)", NULL, gnc_numeric_create(3,1));
   add_pass_test( "plus( 1 : 2 ) + 3", NULL, gnc_numeric_create( 6, 1 ) );
   add_pass_test( "plus( 1 : 2 ) * 3", NULL, gnc_numeric_create( 9, 1 ) );
   add_pass_test( "plus( 1 + 2 : 3 ) * 5", NULL, gnc_numeric_create( 30, 1 ) );

Modified: gnucash/trunk/src/calculation/expression_parser.c
===================================================================
--- gnucash/trunk/src/calculation/expression_parser.c	2006-03-05 15:40:33 UTC (rev 13489)
+++ gnucash/trunk/src/calculation/expression_parser.c	2006-03-05 18:33:34 UTC (rev 13490)
@@ -1067,7 +1067,7 @@
  *  named variables
  *  numerics
  *  grouped expressions, "()"
- *  functions [ <name>( [exp, exp, ..., exp] ) ]
+ *  functions [ <name>( [exp : exp : ... : exp] ) ]
  *  strings
  */
 static void
@@ -1147,10 +1147,10 @@
         assignment_op(pe);
         if ( pe->error_code )
           return;
+        funcArgCount++;
         if (!pe->Token || pe->Token == ')') {
           break;
         }
-        funcArgCount++;
         next_token(pe);
       } while (pe->Token != ARG_TOKEN);
 



More information about the gnucash-changes mailing list