Skip to content

Commit

Permalink
* fixed tests and added tests for <swiftSupport>
Browse files Browse the repository at this point in the history
  • Loading branch information
dkimitsa committed Jul 16, 2022
1 parent 5a723fe commit 83eff48
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@

import static org.junit.Assert.*;

import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.io.*;
import java.util.Arrays;
import java.util.Collections;

Expand Down Expand Up @@ -418,4 +415,34 @@ public void testGetFileName() throws Exception {
assertEquals("com/example/AB9ca44297c0e0d22df654119dce73ee52d3d51c71.class.o",
Config.getFileName("com/example/ABCDEFGIHJABCDEFGIHJABCDEFGIHJABCDEFGIHJABCDEFGIHJ", "class.o", 50));
}

@Test
public void testSwiftSupportEnabledByDefault() throws Exception {
String configText = "<config>\n" +
" <target>ios</target>\n" +
"</config>";
Config.Builder builder = new Config.Builder();

builder.read(new StringReader(configText), wd);
Config config = builder.config;

assertTrue(config.hasSwiftSupport());
assertNotNull(config.getSwiftSupport());
assertTrue(config.getSwiftSupport().isEnabled());
assertTrue(config.getSwiftSupport().shouldCopySwiftLibs());
}

@Test
public void testSwiftSupportCanBeDisabled() throws Exception {
String configText = "<config>\n" +
" <swiftSupport>\n" +
" <enable>false</enable>\n" +
" </swiftSupport>\n" +
"</config>";
Config.Builder builder = new Config.Builder();
builder.read(new StringReader(configText), wd);
Config config = builder.config;
assertFalse(config.hasSwiftSupport());
assertNull(config.getSwiftSupport());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
<framework>Foundation</framework>
<framework>AppKit</framework>
</frameworks>
<swiftSupport>
<enable>true</enable>
<copySwiftLibs>true</copySwiftLibs>
</swiftSupport>
<resources>
<resource>resources</resource>
<resource>/usr/share/resources</resource>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<config>
<swiftSupport>
<enable>true</enable>
<copySwiftLibs>true</copySwiftLibs>
</swiftSupport>
<target>ios</target>
<iosSdkVersion>6.1</iosSdkVersion>
<iosInfoPList>Info.plist</iosInfoPList>
Expand Down

0 comments on commit 83eff48

Please sign in to comment.