mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-15 15:29:22 +00:00
Added support for typscript string enums.
This commit is contained in:
parent
8bb9b89243
commit
df4d8bd91d
@ -147,7 +147,7 @@
|
|||||||
<excludePackageNames>org.jsweet.transpiler.model.support</excludePackageNames>
|
<excludePackageNames>org.jsweet.transpiler.model.support</excludePackageNames>
|
||||||
<fixTags>all</fixTags>
|
<fixTags>all</fixTags>
|
||||||
<failOnError>false</failOnError>
|
<failOnError>false</failOnError>
|
||||||
<!-- leave these options unchanged to place the Javadoc at the right
|
<!-- leave these options unchanged to place the Javadoc at the right
|
||||||
place for jsweet.org -->
|
place for jsweet.org -->
|
||||||
<reportOutputDirectory>/var/www/apidocs/org/jsweet</reportOutputDirectory>
|
<reportOutputDirectory>/var/www/apidocs/org/jsweet</reportOutputDirectory>
|
||||||
<destDir>jsweet-transpiler-${project.version}</destDir>
|
<destDir>jsweet-transpiler-${project.version}</destDir>
|
||||||
@ -248,7 +248,7 @@
|
|||||||
<version>1.4.0.1</version>
|
<version>1.4.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Compile-time only dependency (JSweet looks up installed JDK at runtime
|
<!-- Compile-time only dependency (JSweet looks up installed JDK at runtime
|
||||||
to conform to legal obligations) -->
|
to conform to legal obligations) -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun</groupId>
|
<groupId>com.sun</groupId>
|
||||||
@ -260,7 +260,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jsweet</groupId>
|
<groupId>org.jsweet</groupId>
|
||||||
<artifactId>jsweet-core</artifactId>
|
<artifactId>jsweet-core</artifactId>
|
||||||
<version>6.0.3</version>
|
<version>6.0.4</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* JSweet - http://www.jsweet.org
|
* JSweet - http://www.jsweet.org
|
||||||
* Copyright (C) 2015 CINCHEO SAS <renaud.pawlak@cincheo.fr>
|
* Copyright (C) 2015 CINCHEO SAS <renaud.pawlak@cincheo.fr>
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@ -40,6 +40,7 @@ import source.enums.EnumsImplementingInterfaces;
|
|||||||
import source.enums.EnumsReflection;
|
import source.enums.EnumsReflection;
|
||||||
import source.enums.ErasedEnum;
|
import source.enums.ErasedEnum;
|
||||||
import source.enums.MyComplexEnum2;
|
import source.enums.MyComplexEnum2;
|
||||||
|
import source.enums.StringEnumType;
|
||||||
import source.enums.StringEnums;
|
import source.enums.StringEnums;
|
||||||
import source.enums.SwitchWithEnumWrapper;
|
import source.enums.SwitchWithEnumWrapper;
|
||||||
import source.enums.other.ComplexEnumsAccess;
|
import source.enums.other.ComplexEnumsAccess;
|
||||||
@ -101,7 +102,7 @@ public class EnumTests extends AbstractTest {
|
|||||||
Assert.assertEquals(">", r.get("trace"));
|
Assert.assertEquals(">", r.get("trace"));
|
||||||
}, getSourceFile(EnumsReflection.class));
|
}, getSourceFile(EnumsReflection.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testComplexEnumsAccess() {
|
public void testComplexEnumsAccess() {
|
||||||
eval(ModuleKind.commonjs, (logHandler, r) -> {
|
eval(ModuleKind.commonjs, (logHandler, r) -> {
|
||||||
@ -131,7 +132,7 @@ public class EnumTests extends AbstractTest {
|
|||||||
Assert.assertEquals(">ok1,ok2", r.get("trace"));
|
Assert.assertEquals(">ok1,ok2", r.get("trace"));
|
||||||
}, getSourceFile(ComplexEnumWithAbstractMethods.class));
|
}, getSourceFile(ComplexEnumWithAbstractMethods.class));
|
||||||
transpilerTest().getTranspiler().setBundle(false);
|
transpilerTest().getTranspiler().setBundle(false);
|
||||||
|
|
||||||
TranspilerTestRunner transpilerTest = new TranspilerTestRunner(getCurrentTestOutDir(), new AddRootFactory());
|
TranspilerTestRunner transpilerTest = new TranspilerTestRunner(getCurrentTestOutDir(), new AddRootFactory());
|
||||||
transpilerTest.eval((logHandler, r) -> {
|
transpilerTest.eval((logHandler, r) -> {
|
||||||
assertEquals("There should be no errors", 0, logHandler.reportedProblems.size());
|
assertEquals("There should be no errors", 0, logHandler.reportedProblems.size());
|
||||||
@ -199,5 +200,9 @@ public class EnumTests extends AbstractTest {
|
|||||||
logHandler.assertNoProblems();
|
logHandler.assertNoProblems();
|
||||||
}, getSourceFile(EnumInOtherPackage.class), getSourceFile(EnumWrapper.class), getSourceFile(SwitchWithEnumWrapper.class));
|
}, getSourceFile(EnumInOtherPackage.class), getSourceFile(EnumWrapper.class), getSourceFile(SwitchWithEnumWrapper.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStringEnum() {
|
||||||
|
transpile(TestTranspilationHandler::assertNoProblems, getSourceFile(StringEnumType.class));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,9 @@
|
|||||||
|
package source.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import jsweet.lang.StringEnum;
|
||||||
|
|
||||||
|
@StringEnum
|
||||||
|
public enum StringEnumType {
|
||||||
|
TEST1, TEST2, TEST3
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user