Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: run tests on windows #575

Merged
merged 3 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
needs: build
strategy:
matrix:
os: [ ubuntu-latest ]
os: [ ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.mockito.Mockito;

import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -74,6 +76,7 @@ public void testDest() throws IOException {
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testDestAndUnaryAsterisk() throws IOException {
PropertiesWithFiles pb = NewPropertiesWithFilesUtilBuilder
.minimalBuiltPropertiesBean(
Expand Down Expand Up @@ -106,6 +109,7 @@ public void testDestAndUnaryAsterisk() throws IOException {
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testDifferentPatterns() throws IOException {
PropertiesWithFiles pb = NewPropertiesWithFilesUtilBuilder
.minimalBuiltPropertiesBean("/folder_1/**/*.xml", "/%locale%/folder_1/**/%file_name%.xml")
Expand Down Expand Up @@ -174,6 +178,7 @@ public void testDifferentPatterns() throws IOException {
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testWithPreserveHierarchyFalse() throws IOException {
PropertiesWithFiles pb = NewPropertiesWithFilesUtilBuilder
.minimalBuiltPropertiesBean("/folder_1/**/*.xml", "/%locale%/folder_1/**/%file_name%.xml")
Expand Down Expand Up @@ -240,6 +245,7 @@ public void testWithPreserveHierarchyFalse() throws IOException {
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testDryRun() {
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
PrintStream ps = System.out;
Expand Down Expand Up @@ -278,6 +284,7 @@ public void testDryRun() {
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testReviewedOnly() throws IOException {
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
PrintStream ps = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import com.crowdin.cli.commands.Outputter;
import com.crowdin.client.sourcefiles.model.File;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -55,6 +57,7 @@ public void testSimple_oneLocalFile_oneProjectFile_noObsolete() {
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testSimple_oneLocalFile_twoProjectFile_oneObsolete() {
final String exportPattern = "/%file_name%.csv";
final String projectFilePath = "file1.csv";
Expand Down Expand Up @@ -124,6 +127,7 @@ public void testSimple_oneLocalFile_twoProjectFile_oneIgnoreProjectFile_noObsole
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testSimple_oneLocalFile_twoProjectFile_oneObsoleteFile_oneObsoleteDirectory() {
final String exportPattern = "/**/%file_name%.csv";
final String projectFilePath = "path/to/file1.csv";
Expand Down Expand Up @@ -165,6 +169,7 @@ public void testSimple_oneLocalFile_twoProjectFile_oneObsoleteFile_oneObsoleteDi
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testSimple_oneLocalFile_twoProjectFile_oneObsoleteFile_noPreserveHierarchy() {
final String exportPattern = "/**/%file_name%.csv";
String projectFilePath = "file1.csv";
Expand Down Expand Up @@ -200,6 +205,7 @@ public void testSimple_oneLocalFile_twoProjectFile_oneObsoleteFile_noPreserveHie
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testSimple_oneLocalFile_twoProjectFile_oneObsoleteFile_noPreserveHierarchy_2_withFolders() {
final String exportPattern = "/**/%file_name%.csv";
String projectFilePath = "to/file1.csv";
Expand Down Expand Up @@ -237,6 +243,7 @@ public void testSimple_oneLocalFile_twoProjectFile_oneObsoleteFile_noPreserveHie
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testSimple_oneLocalFile_twoProjectFile_oneObsoleteFile_twoObsoleteDirectory() {
final String exportPattern = "/**/%file_name%.csv";
final String projectFilePath = "path/to/file1.csv";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import com.crowdin.client.sourcefiles.model.GeneralFileExportOptions;
import com.crowdin.client.sourcefiles.model.PropertyFileExportOptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
Expand Down Expand Up @@ -52,6 +54,7 @@ public void testIsMultilingualFile() {

@ParameterizedTest
@MethodSource
@DisabledOnOs(OS.WINDOWS)
public void isProjectFileSatisfiesThePatternsTest(String projectFilePath, String sourcePattern, List<String> ignorePattern, boolean preserveHierarchy, boolean expected) {
assertEquals(expected, ProjectFilesUtils.isProjectFilePathSatisfiesPatterns(sourcePattern, ignorePattern, preserveHierarchy).test(projectFilePath));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
Expand Down Expand Up @@ -88,6 +90,7 @@ static Stream<Arguments> testGetFiles1() {

@ParameterizedTest
@MethodSource
@DisabledOnOs(OS.WINDOWS)
public void testFilterProjectFiles_wPreserveHierarchy_noIgnores(List<String> filePaths, String sourcePattern, List<String> expected) {
List<String> actual = SourcesUtils.filterProjectFiles(
filePaths, sourcePattern, Collections.EMPTY_LIST, true, PlaceholderUtilBuilder.STANDART.build(""));
Expand Down Expand Up @@ -156,6 +159,7 @@ static Stream<Arguments> testFilterProjectFiles_wPreserveHierarchy_noIgnores() {

@ParameterizedTest
@MethodSource
@DisabledOnOs(OS.WINDOWS)
public void testFilterProjectFiles_wPreserveHierarchy_wIgnores(
List<String> filePaths, String sourcePattern, List<String> ignorePatterns, List<String> expected
) {
Expand Down Expand Up @@ -237,6 +241,7 @@ static Stream<Arguments> testFilterProjectFiles_wPreserveHierarchy_wIgnores() {

@ParameterizedTest
@MethodSource
@DisabledOnOs(OS.WINDOWS)
public void testFilterProjectFiles_noPreserveHierarchy_noIgnores(List<String> filePaths, String sourcePattern, List<String> expected) {
List<String> actual = SourcesUtils.filterProjectFiles(
filePaths, sourcePattern, Collections.emptyList(), false, PlaceholderUtilBuilder.STANDART.build(""));
Expand Down Expand Up @@ -276,6 +281,7 @@ static Stream<Arguments> testFilterProjectFiles_noPreserveHierarchy_noIgnores()

@ParameterizedTest
@MethodSource
@DisabledOnOs(OS.WINDOWS)
public void testFilterProjectFiles_noPreserveHierarchy_wIgnores(
List<String> filePaths, String sourcePattern, List<String> ignorePatterns, List<String> expected
) {
Expand Down Expand Up @@ -335,6 +341,7 @@ static Stream<Arguments> testFilterProjectFiles_noPreserveHierarchy_wIgnores() {
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testFilterProjectFiles_dest() {
List<String> filePaths = Arrays.asList("common/strings.xml");
String sourcePattern = "/common/%original_file_name%";
Expand Down Expand Up @@ -368,6 +375,7 @@ private static Stream<Arguments> testContainsParameter() {

@ParameterizedTest
@MethodSource
@DisabledOnOs(OS.WINDOWS)
public void testReplaceUnaryAsterisk(String sourcePattern, String projectFile, String expected) {
assertEquals(SourcesUtils.replaceUnaryAsterisk(sourcePattern, projectFile), expected);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.crowdin.cli.utils.Utils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
Expand All @@ -18,6 +20,7 @@ public class TranslationsUtilsTest {

@ParameterizedTest
@MethodSource
@DisabledOnOs(OS.WINDOWS)
public void testReplaceDoubleAsterisk(String sourcePattern, String translationPattern, String sourceFile, String expected) {
String result = TranslationsUtils.replaceDoubleAsterisk(sourcePattern, translationPattern, sourceFile);
assertEquals(expected, result,
Expand Down
3 changes: 3 additions & 0 deletions src/test/java/com/crowdin/cli/utils/PlaceholderUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.crowdin.cli.client.LanguageMapping;
import com.crowdin.client.languages.model.Language;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
Expand Down Expand Up @@ -137,6 +139,7 @@ public void testReplaceLanguageDependentPlaceholders() {

@ParameterizedTest
@MethodSource
@DisabledOnOs(OS.WINDOWS)
public void testDoubleAsteriskInWildCard(String source, File crowdinFile, String expected) {
PlaceholderUtil placeholderUtil = new PlaceholderUtil(new ArrayList<>(), new ArrayList<>(), "./");
assertEquals(expected, placeholderUtil.replaceFileDependentPlaceholders(source, crowdinFile));
Expand Down