use of org.graalvm.options.OptionDescriptor in project graal by oracle.
the class OptionProcessorTest method testTestLang.
@Test
public void testTestLang() {
Engine engine = Engine.create();
OptionDescriptors descriptors = engine.getLanguages().get("optiontestlang1").getOptions();
OptionDescriptor descriptor;
OptionDescriptor descriptor1;
OptionDescriptor descriptor2;
descriptor1 = descriptor = descriptors.get("optiontestlang1.StringOption1");
assertNotNull(descriptor);
assertTrue(descriptor.isDeprecated());
assertSame(OptionCategory.USER, descriptor.getCategory());
assertEquals("StringOption1 help", descriptor.getHelp());
assertSame(OptionTestLang1.StringOption1, descriptor.getKey());
descriptor2 = descriptor = descriptors.get("optiontestlang1.StringOption2");
assertNotNull(descriptor);
assertEquals("StringOption2 help", descriptor.getHelp());
assertFalse(descriptor.isDeprecated());
assertSame(OptionCategory.EXPERT, descriptor.getCategory());
assertSame(OptionTestLang1.StringOption2, descriptor.getKey());
Iterator<OptionDescriptor> iterator = descriptors.iterator();
assertTrue(iterator.hasNext());
assertEquals(descriptor1, iterator.next());
assertTrue(iterator.hasNext());
assertEquals(descriptor2, iterator.next());
assertFalse(iterator.hasNext());
assertNull(descriptors.get("optiontestlang1.StringOption3"));
}
use of org.graalvm.options.OptionDescriptor in project graal by oracle.
the class EngineAPITest method getLanguageOptions.
@Test
public void getLanguageOptions() {
Engine engine = Engine.create();
Language language = engine.getLanguages().get(EngineAPITestLanguage.ID);
OptionDescriptor descriptor1 = language.getOptions().get(EngineAPITestLanguage.Option1_NAME);
OptionDescriptor descriptor2 = language.getOptions().get(EngineAPITestLanguage.Option2_NAME);
OptionDescriptor descriptor3 = language.getOptions().get(EngineAPITestLanguage.Option3_NAME);
assertSame(EngineAPITestLanguage.Option1, descriptor1.getKey());
assertEquals(EngineAPITestLanguage.Option1_NAME, descriptor1.getName());
assertEquals(EngineAPITestLanguage.Option1_CATEGORY, descriptor1.getCategory());
assertEquals(EngineAPITestLanguage.Option1_DEPRECATED, descriptor1.isDeprecated());
assertEquals(EngineAPITestLanguage.Option1_HELP, descriptor1.getHelp());
assertSame(EngineAPITestLanguage.Option2, descriptor2.getKey());
assertEquals(EngineAPITestLanguage.Option2_NAME, descriptor2.getName());
assertEquals(EngineAPITestLanguage.Option2_CATEGORY, descriptor2.getCategory());
assertEquals(EngineAPITestLanguage.Option2_DEPRECATED, descriptor2.isDeprecated());
assertEquals(EngineAPITestLanguage.Option2_HELP, descriptor2.getHelp());
assertSame(EngineAPITestLanguage.Option3, descriptor3.getKey());
assertEquals(EngineAPITestLanguage.Option3_NAME, descriptor3.getName());
assertEquals(EngineAPITestLanguage.Option3_CATEGORY, descriptor3.getCategory());
assertEquals(EngineAPITestLanguage.Option3_DEPRECATED, descriptor3.isDeprecated());
assertEquals(EngineAPITestLanguage.Option3_HELP, descriptor3.getHelp());
engine.close();
}
Aggregations