[Nice-commit] Nice/src/nice/tools/testsuite TestCase.java,1.17,1.18 NiceSourceFile.java,1.15,1.16
Brought to you by:
bonniot
|
From: <bo...@us...> - 2003-02-21 15:17:56
|
Update of /cvsroot/nice/Nice/src/nice/tools/testsuite
In directory sc8-pr-cvs1:/tmp/cvs-serv30742/src/nice/tools/testsuite
Modified Files:
TestCase.java NiceSourceFile.java
Log Message:
Correctly compute line number for code in the main section, when there is
a toplevel section as well.
Index: TestCase.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/TestCase.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** TestCase.java 19 Feb 2003 18:30:25 -0000 1.17
--- TestCase.java 21 Feb 2003 15:17:52 -0000 1.18
***************
*** 220,227 ****
columnNum++;
int lineNum = _lineCounter + _currentSourceFile.getCountImports() + 2;
- if (_currentSourceFile.getStatus() == NiceSourceFile.STATUS_MAIN)
- lineNum += 2;
//System.out.println("_lineCounter: " + _lineCounter + " _currentSourceFile.getCountImports(): " + _currentSourceFile.getCountImports());
! _failPositions.add(new FailPosition(_currentSourceFile.getFileName(), lineNum, columnNum + 1));
}
}
--- 220,230 ----
columnNum++;
int lineNum = _lineCounter + _currentSourceFile.getCountImports() + 2;
//System.out.println("_lineCounter: " + _lineCounter + " _currentSourceFile.getCountImports(): " + _currentSourceFile.getCountImports());
! _failPositions.add
! (new FailPosition
! (_currentSourceFile.getFileName(),
! lineNum, columnNum + 1,
! _currentSourceFile,
! _currentSourceFile.getStatus() == NiceSourceFile.STATUS_MAIN));
}
}
***************
*** 476,484 ****
private int _line;
private int _column;
! FailPosition(String fileName, int line, int column) {
_fileName = fileName;
_line = line;
_column = column;
}
--- 479,492 ----
private int _line;
private int _column;
+ private NiceSourceFile _sourceFile;
+ private boolean _inMain;
! FailPosition(String fileName, int line, int column,
! NiceSourceFile sourceFile, boolean inMain) {
_fileName = fileName;
_line = line;
_column = column;
+ _sourceFile = sourceFile;
+ _inMain = inMain;
}
***************
*** 488,492 ****
protected int getLine() {
! return _line;
}
--- 496,505 ----
protected int getLine() {
! int res = _line;
! if (_inMain)
! // Add the number of lines of the toplevel code,
! // plus two lines for the main section header.
! res += _sourceFile.getTopLevelSectionLength() + 2;
! return res;
}
Index: NiceSourceFile.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/nice/tools/testsuite/NiceSourceFile.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** NiceSourceFile.java 19 Feb 2003 18:30:28 -0000 1.15
--- NiceSourceFile.java 21 Feb 2003 15:17:53 -0000 1.16
***************
*** 59,62 ****
--- 59,68 ----
*/
private StringBuffer _mainMethodContent = new StringBuffer();
+
+ /**
+ * Number of lines writte for the main section.
+ */
+
+ private int _topLevelSectionLength = 0;
/**
* TODO
***************
*** 151,156 ****
--- 157,167 ----
public void addToTopLevel(String line) {
_topLevelContent.append(line).append('\n');
+ _topLevelSectionLength++;
}
+
+ public int getTopLevelSectionLength() {
+ return _topLevelSectionLength;
+ }
/**
|