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

Fix incorrect file name regex logic #21

Merged
merged 5 commits into from
Nov 30, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,8 @@ private static boolean fileContentEquals(File file, String code) throws IOExcept
}
return false;
}

private static String getDebugFileName( String file ) {
String result = file.replace( ".js", "-debug.js");
return result;

protected static String getDebugFileName( String file ) {
return file.replaceFirst( ".js$" , "-debug.js" );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2018-present Sonatype, Inc.
*
* This file is part of DirectJNgine.
*
* DirectJNgine is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License.
*
* Commercial use is permitted to the extent that the code/component(s)
* do NOT become part of another Open Source or Commercially developed
* licensed development library or toolkit without explicit permission.
*
* DirectJNgine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with DirectJNgine. If not, see <http://www.gnu.org/licenses/>.
*
* This software uses the ExtJs library (http://extjs.com), which is
* distributed under the GPL v3 license (see http://extjs.com/license).
*/
package com.softwarementors.extjs.djn.jscodegen;
dbradicich marked this conversation as resolved.
Show resolved Hide resolved

import org.testng.annotations.Test;

import static org.testng.Assert.assertEquals;

public class CodeFileGeneratorTest {

@Test
public void getDebugFileNameTest() {
assertEquals( "john.jspiner" , CodeFileGenerator.getDebugFileName( "john.jspiner" ) );
assertEquals( "app-debug.js" , CodeFileGenerator.getDebugFileName( "app.js" ) );
}
}