Update of /cvsroot/nice/Nice/src/nice/tools/testsuite
In directory sc8-pr-cvs1:/tmp/cvs-serv1306/src/nice/tools/testsuite
Modified Files:
TestCase.java NiceSourceFile.java
Log Message:
Correctly count line numbers at toplevel if there is also a main section.
Index: TestCase.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/TestCase.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** TestCase.java 27 Nov 2003 22:45:59 -0000 1.26
--- TestCase.java 8 Dec 2003 18:37:11 -0000 1.27
***************
*** 523,526 ****
--- 523,530 ----
// plus two lines for the main section header.
res += _sourceFile.getTopLevelSectionLength() + 2;
+ else
+ // The main method is moved after toplevel, so adjust by removing
+ // that count.
+ res -= _sourceFile.getMainSectionLength();
return res;
}
Index: NiceSourceFile.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/NiceSourceFile.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** NiceSourceFile.java 6 Jun 2003 10:09:04 -0000 1.17
--- NiceSourceFile.java 8 Dec 2003 18:37:11 -0000 1.18
***************
*** 65,68 ****
--- 65,75 ----
private int _topLevelSectionLength = 0;
+
+ /**
+ * Number of lines in the main method section.
+ */
+
+ private int _mainSectionLength = 0;
+
/**
* TODO
***************
*** 148,151 ****
--- 155,159 ----
public void addToMainMethod(String line) {
_mainMethodContent.append(line).append('\n');
+ _mainSectionLength++;
}
***************
*** 163,166 ****
--- 171,178 ----
public int getTopLevelSectionLength() {
return _topLevelSectionLength;
+ }
+
+ public int getMainSectionLength() {
+ return _mainSectionLength;
}
|