1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Restoring keyword.txt loading and parsing. Added token type identifiers and related style in theme.txt

This commit is contained in:
Federico Fissore
2015-04-27 17:23:44 +02:00
parent 5eca70b1d0
commit 9ebe916fac
12 changed files with 474 additions and 410 deletions

View File

@ -41,6 +41,8 @@ public abstract class AbstractWithPreferencesTest {
Preferences.init(null);
Theme.init();
BaseNoGui.initPackages();
Base.untitledFolder = Base.createTempFolder("untitled");
DeleteFilesOnShutdown.add(Base.untitledFolder);
}

View File

@ -0,0 +1,30 @@
package processing.app.syntax;
import org.fife.ui.rsyntaxtextarea.TokenTypes;
import org.junit.Test;
import processing.app.AbstractWithPreferencesTest;
import processing.app.BaseNoGui;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class PdeKeywordsTest extends AbstractWithPreferencesTest {
@Test
public void testKeywordsTxtParsing() throws Exception {
PdeKeywords pdeKeywords = new PdeKeywords();
pdeKeywords.reload();
assertEquals("Constants", pdeKeywords.getReference("HIGH"));
assertEquals("IDENTIFIER", pdeKeywords.getTokenTypeAsString("HIGH"));
assertEquals(TokenTypes.IDENTIFIER, pdeKeywords.getTokenType("HIGH".toCharArray(), 0, 3));
assertEquals("IncrementCompound", pdeKeywords.getReference("+="));
assertNull(pdeKeywords.getTokenTypeAsString("+="));
assertNull(pdeKeywords.getReference("Mouse"));
assertEquals("VARIABLE", pdeKeywords.getTokenTypeAsString("Mouse"));
assertEquals(TokenTypes.VARIABLE, pdeKeywords.getTokenType("Mouse".toCharArray(), 0, 4));
}
}