Skip to content

Commit

Permalink
Test for handling multiline texts in suite.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaroslav Tulach committed Feb 11, 2024
1 parent 4c43851 commit e5c131a
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URL;
import java.nio.file.FileVisitResult;
import java.nio.file.FileVisitor;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
import org.netbeans.junit.NbTestCase;
import org.netbeans.modules.java.mx.project.suitepy.MxDistribution;
import org.netbeans.modules.java.mx.project.suitepy.MxSuite;

public final class ParseSuitesTest extends NbTestCase {
Expand All @@ -39,6 +42,15 @@ public ParseSuitesTest(String name) {
public void testParseThemAll() throws IOException {
assertSuitePys(getDataDir(), 15);
}

public void testParseMultiLineSuite() throws IOException {
URL url = getClass().getResource("multilinetexts.py");
MxSuite suite = MxSuite.parse(url);
assertNotNull("suite parsed", suite);
MxDistribution tool = suite.distributions().get("TOOLCHAIN");
assertNotNull("toolchain found", tool);
assertEquals("No deps", 0, tool.dependencies().size());
}

public static void main(String... args) throws IOException {
if (args.length == 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.


suite = {
"mxversion": "7.5.0",
"name" : "multilinetexts",
"version" : "1.0.0",
"repositories" : {
},
"libraries" : {
},
"licenses" : {
},
"distributions" : {
"TOOLCHAIN": {
"native": True,
"platformDependent": True,
"os": {
"linux": {
"layout": {
"toolchain.multi": {
"source_type": "string",
"value": '''
line1
line2
line3
line5
'''
},
},
"dependencies": [
],
},
},
"maven" : False,
},
},
}

0 comments on commit e5c131a

Please sign in to comment.