-
-
Notifications
You must be signed in to change notification settings - Fork 388
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #697 from freakboy3742/safe-android-formal-name
Fixes #696 - Allow for punctuation in Android formal names
- Loading branch information
Showing
4 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Android projects that have punctuation in their formal names can now build without error. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import pytest | ||
|
||
from briefcase.platforms.android.gradle import safe_formal_name | ||
|
||
|
||
@pytest.mark.parametrize( | ||
'formal_name, safe_name', | ||
[ | ||
('Hello World', 'Hello World'), | ||
# The invalid list is all stripped | ||
('Hello/World/', 'HelloWorld'), | ||
('Hello\\World', 'HelloWorld'), | ||
('Hello:World', 'HelloWorld'), | ||
('Hello<World', 'HelloWorld'), | ||
('Hello>World', 'HelloWorld'), | ||
('Hello "World"', 'Hello World'), | ||
('Hello World?', 'Hello World'), | ||
('Hello|World', 'HelloWorld'), | ||
('Hello World!', 'Hello World'), | ||
# All invalid punctuation is removed | ||
# Valid punctuation is preserved | ||
('Hello! (World?)', 'Hello (World)'), | ||
# Position of punctuation doesn't matter | ||
('Hello! World', 'Hello World'), | ||
('!Hello World', 'Hello World'), | ||
# If removing punctuation leads to double spaces, reduce the double spaces | ||
('Hello | World', 'Hello World'), | ||
('Hello World |', 'Hello World'), | ||
('| Hello World', 'Hello World'), | ||
] | ||
) | ||
def test_safe_formal_name(formal_name, safe_name): | ||
assert safe_formal_name(formal_name) == safe_name |