r22121 - gnucash/trunk/test-templates - Testing: fix search_local() for detecting callbacks and references.mv
John Ralls
jralls at code.gnucash.org
Sun Mar 25 12:52:31 EDT 2012
Author: jralls
Date: 2012-03-25 12:52:31 -0400 (Sun, 25 Mar 2012)
New Revision: 22121
Trac: http://svn.gnucash.org/trac/changeset/22121
Modified:
gnucash/trunk/test-templates/make-testfile
Log:
Testing: fix search_local() for detecting callbacks and references.mv
Modified: gnucash/trunk/test-templates/make-testfile
===================================================================
--- gnucash/trunk/test-templates/make-testfile 2012-03-25 16:52:22 UTC (rev 22120)
+++ gnucash/trunk/test-templates/make-testfile 2012-03-25 16:52:31 UTC (rev 22121)
@@ -123,14 +123,21 @@
my $comment = 0;
my $line;
my ($calls, $callbacks, $refs) = (0, 0, 0);
- my $call_re = qr{\b$name\s*\(\w*[,)]};
- my $callback_re = qr{\([^)]*$name(?>!\s*\()};
- my $ref_re = qr{(?<=\=)\s*$name(?>!\s*\()};
+ my $call_re = qr/\b$name\b\s*\([^{]*$/;
+ my $callback_re = qr{\b$name\s*[,)]};
+ my $ref_re = qr{=\s*\b$name\b(?!\s*\()};
+ my $body = 0;
while (my $line = <INFILE>) {
chomp $line;
+ while ($line =~ /{/g) {
+ ++$body;
+ }
+ while ($line =~ /}/g) {
+ --$body;
+ }
($line, $comment) = strip_comments($line, $comment);
- ++ $calls if $line =~ /$call_re/;
- ++ $callbacks if $line =~ /$callback_re/;
+ ++ $calls if $body && $line =~ /$call_re/;
+ ++ $callbacks if $body && $line =~ /$callback_re/;
++ $refs if $line =~ /$ref_re/;
}
More information about the gnucash-changes
mailing list