}
public void testStringAddition() {
strategy.setIndentPrefs(new TestIndentPrefs(true, 4, true));
String doc = "";
DocCmd docCmd;
String expected;
doc = "var";
docCmd = new DocCmd(0, 0, "'");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = "'"; //just a single one
assertEquals(expected, docCmd.text);
doc = "''";
docCmd = new DocCmd(doc.length() - 1, 0, "'");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = ""; //just walk with the cursor
assertEquals(expected, docCmd.text);
doc = "''";
docCmd = new DocCmd(0, 0, "'");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = "'"; //don't walk with the cursor and add so that the document becomes '''
assertEquals(expected, docCmd.text);
doc = "";
docCmd = new DocCmd(doc.length(), 0, "'");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = "''";
assertEquals(expected, docCmd.text);
doc = "'"; //already opened
docCmd = new DocCmd(doc.length(), 0, "'");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = "'";
assertEquals(expected, docCmd.text);
doc = "#"; //on comment should not close
docCmd = new DocCmd(doc.length(), 0, "'");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = "'";
assertEquals(expected, docCmd.text);
doc = "'ueuouo"; //already opened
docCmd = new DocCmd(doc.length(), 0, "'");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = "'";
assertEquals(expected, docCmd.text);
doc = "'ueuouo' and "; //all is properly balanced, so, auto close it.
docCmd = new DocCmd(doc.length(), 0, "'");
strategy.customizeDocumentCommand(new Document(doc), docCmd);
expected = "''";
assertEquals(expected, docCmd.text);
doc = "'ueuouo'"; //already opened
docCmd = new DocCmd(0, doc.length(), "'");
Document document = new Document(doc);
strategy.customizeDocumentCommand(document, docCmd);
assertEquals("''", docCmd.text);
doc = "ueuo\nuo";
docCmd = new DocCmd(0, doc.length(), "\"");
document = new Document(doc);
strategy.customizeDocumentCommand(document, docCmd);
assertEquals("\"\"", docCmd.text);
doc = "a";
docCmd = new DocCmd(0, doc.length(), "\"");
document = new Document(doc);
strategy.customizeDocumentCommand(document, docCmd);
assertEquals("\"\"", docCmd.text);
doc = "')' ";
docCmd = new DocCmd(0, doc.length(), "'");
document = new Document(doc);
strategy.customizeDocumentCommand(document, docCmd);
assertEquals("''", docCmd.text);
}