-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format CFBundleShortVersionString to spec
According to Apple: > The release version number is a string composed of three period-separated integers. This change makes an attempt to pull out a string that is valid for CFBundleShortVersionString from the input, returning the input if no matches are found
- Loading branch information
1 parent
bf174cd
commit f5577a2
Showing
2 changed files
with
68 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
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,50 @@ | ||
import { getCFBundleShortVersionString } from '../'; | ||
import test from "ava"; | ||
|
||
test( | ||
"CFBundleShortVersionString basic", | ||
t => { | ||
const v = getCFBundleShortVersionString('1.2.3'); | ||
t.is(v, '1.2.3'); | ||
} | ||
); | ||
|
||
test( | ||
"CFBundleShortVersionString alpha", | ||
t => { | ||
const v = getCFBundleShortVersionString('1.2.3-alpha'); | ||
t.is(v, '1.2.3'); | ||
} | ||
); | ||
|
||
test( | ||
"CFBundleShortVersionString alpha point", | ||
t => { | ||
const v = getCFBundleShortVersionString('1.2.3-alpha.0'); | ||
t.is(v, '1.2.3'); | ||
} | ||
); | ||
|
||
test( | ||
"CFBundleShortVersionString dash number", | ||
t => { | ||
const v = getCFBundleShortVersionString('1.2.3-0'); | ||
t.is(v, '1.2.3'); | ||
} | ||
); | ||
|
||
test( | ||
"CFBundleShortVersionString extra dot", | ||
t => { | ||
const v = getCFBundleShortVersionString('1.2.3.0'); | ||
t.is(v, '1.2.3'); | ||
} | ||
); | ||
|
||
test( | ||
"CFBundleShortVersionString garbage in, garbage out", | ||
t => { | ||
const v = getCFBundleShortVersionString('garbage'); | ||
t.is(v, 'garbage'); | ||
} | ||
); |