/** * Test for Linter::findLineNumberAndColumn * * @return void */ public function testFindLineNumberAndColumn() { // Let the analyzed string be: // ^abc$ // ^de$ // ^$ // // Where `^` is the beginning of the line and `$` the end of the line. // // Positions of each character (by line): // ( a, 0), ( b, 1), ( c, 2), (\n, 3), // ( d, 4), ( e, 5), (\n, 6), // (\n, 7). $this->assertEquals(array(1, 0), Linter::findLineNumberAndColumn(array(0, 4, 7), 4)); $this->assertEquals(array(1, 1), Linter::findLineNumberAndColumn(array(0, 4, 7), 5)); $this->assertEquals(array(1, 2), Linter::findLineNumberAndColumn(array(0, 4, 7), 6)); $this->assertEquals(array(2, 0), Linter::findLineNumberAndColumn(array(0, 4, 7), 7)); }