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:
@ -41,6 +41,8 @@ public abstract class AbstractWithPreferencesTest {
|
||||
Preferences.init(null);
|
||||
Theme.init();
|
||||
|
||||
BaseNoGui.initPackages();
|
||||
|
||||
Base.untitledFolder = Base.createTempFolder("untitled");
|
||||
DeleteFilesOnShutdown.add(Base.untitledFolder);
|
||||
}
|
||||
|
30
app/test/processing/app/syntax/PdeKeywordsTest.java
Normal file
30
app/test/processing/app/syntax/PdeKeywordsTest.java
Normal 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));
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user