Skip to content

Commit

Permalink
Merge branch 'dev' into #88.InvestigateTmpCompleteTests
Browse files Browse the repository at this point in the history
  • Loading branch information
curious-odd-man committed Feb 24, 2024
2 parents 5c9340a + 9eb48f4 commit add7655
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/java/com/github/curiousoddman/rgxgen/model/GroupType.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
package com.github.curiousoddman.rgxgen.model;

/* **************************************************************************
Copyright 2019 Vladislavs Varslavans
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
/* **************************************************************************/

public enum GroupType {
POSITIVE_LOOKAHEAD,
NEGATIVE_LOOKAHEAD,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
package com.github.curiousoddman.rgxgen.model;

/* **************************************************************************
Copyright 2019 Vladislavs Varslavans
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
/* **************************************************************************/

public enum WhitespaceChar {
SPACE(' '),
TAB('\t'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
package com.github.curiousoddman.rgxgen.parsing.dflt;

/* **************************************************************************
Copyright 2019 Vladislavs Varslavans
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
/* **************************************************************************/

public class PatternDoesNotMatchAnythingException extends RgxGenParseException {
public PatternDoesNotMatchAnythingException(String s) {
super(s);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
package com.github.curiousoddman.rgxgen.parsing.dflt;

/* **************************************************************************
Copyright 2019 Vladislavs Varslavans
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
/* **************************************************************************/

public class TokenNotQuantifiableException extends RgxGenParseException {
public TokenNotQuantifiableException(String s) {
super(s);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.github.curiousoddman.rgxgen;

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

public class LicenseCheckerTest {
private static final String LICENCE = readLicenceFile();

@ParameterizedTest
@MethodSource("getAllSourceFiles")
void checkLicence(Path path) throws IOException {
assumeTrue(path.toString().endsWith(".java"));
String contents = String.join("\n", Files.readAllLines(path));
assertTrue(contents.contains(LICENCE));
}

private static String readLicenceFile() {
try {
List<String> allLines = Files.readAllLines(Paths.get("LICENSE.txt"));
List<String> licenseText = allLines.subList(189, 202);
return String.join("\n", licenseText);
} catch (IOException e) {
throw new RuntimeException(e);
}
}

public static Stream<Path> getAllSourceFiles() {
try {
try (Stream<Path> files = Files.walk(Paths.get("src/main"))) {
return files
.filter(Files::isRegularFile)
.collect(Collectors.toList())
.stream();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

0 comments on commit add7655

Please sign in to comment.