@@ -199,3 +199,187 @@ test(
199199 ] ) ,
200200 ) ,
201201) ;
202+
203+ test (
204+ "should parse a major version with prerelease" ,
205+ check (
206+ "foo/bar@v1-beta" ,
207+ ok ( [
208+ {
209+ slug : {
210+ owner : "foo" ,
211+ repository : "bar" ,
212+ } ,
213+ binaryName : none ( ) ,
214+ tag : "v1-beta" as SemanticVersion ,
215+ checksum : none ( ) ,
216+ } ,
217+ ] ) ,
218+ ) ,
219+ ) ;
220+
221+ test (
222+ "should parse a major version with prerelease and number" ,
223+ check (
224+ "foo/bar@v1-beta.123" ,
225+ ok ( [
226+ {
227+ slug : {
228+ owner : "foo" ,
229+ repository : "bar" ,
230+ } ,
231+ binaryName : none ( ) ,
232+ tag : "v1-beta.123" as SemanticVersion ,
233+ checksum : none ( ) ,
234+ } ,
235+ ] ) ,
236+ ) ,
237+ ) ;
238+
239+ test (
240+ "should parse a major.minor version with prerelease" ,
241+ check (
242+ "foo/bar@v1.1-beta" ,
243+ ok ( [
244+ {
245+ slug : {
246+ owner : "foo" ,
247+ repository : "bar" ,
248+ } ,
249+ binaryName : none ( ) ,
250+ tag : "v1.1-beta" as SemanticVersion ,
251+ checksum : none ( ) ,
252+ } ,
253+ ] ) ,
254+ ) ,
255+ ) ;
256+
257+ test (
258+ "should parse a major.minor version with prerelease and number" ,
259+ check (
260+ "foo/bar@v1.1-beta.123" ,
261+ ok ( [
262+ {
263+ slug : {
264+ owner : "foo" ,
265+ repository : "bar" ,
266+ } ,
267+ binaryName : none ( ) ,
268+ tag : "v1.1-beta.123" as SemanticVersion ,
269+ checksum : none ( ) ,
270+ } ,
271+ ] ) ,
272+ ) ,
273+ ) ;
274+
275+ test (
276+ "should parse a major.minor.patch version with prerelease" ,
277+ check (
278+ "foo/bar@v1.2.3-alpha.1" ,
279+ ok ( [
280+ {
281+ slug : {
282+ owner : "foo" ,
283+ repository : "bar" ,
284+ } ,
285+ binaryName : none ( ) ,
286+ tag : "v1.2.3-alpha.1" as SemanticVersion ,
287+ checksum : none ( ) ,
288+ } ,
289+ ] ) ,
290+ ) ,
291+ ) ;
292+
293+ test (
294+ "should parse a major version with build metadata" ,
295+ check (
296+ "foo/bar@v1+build.123" ,
297+ ok ( [
298+ {
299+ slug : {
300+ owner : "foo" ,
301+ repository : "bar" ,
302+ } ,
303+ binaryName : none ( ) ,
304+ tag : "v1+build.123" as SemanticVersion ,
305+ checksum : none ( ) ,
306+ } ,
307+ ] ) ,
308+ ) ,
309+ ) ;
310+
311+ test (
312+ "should parse a major.minor version with build metadata" ,
313+ check (
314+ "foo/bar@v1.1+build.123" ,
315+ ok ( [
316+ {
317+ slug : {
318+ owner : "foo" ,
319+ repository : "bar" ,
320+ } ,
321+ binaryName : none ( ) ,
322+ tag : "v1.1+build.123" as SemanticVersion ,
323+ checksum : none ( ) ,
324+ } ,
325+ ] ) ,
326+ ) ,
327+ ) ;
328+
329+ test (
330+ "should parse a major.minor.patch version with prerelease and build metadata" ,
331+ check (
332+ "foo/bar@v1.2.3-rc.1+build.456" ,
333+ ok ( [
334+ {
335+ slug : {
336+ owner : "foo" ,
337+ repository : "bar" ,
338+ } ,
339+ binaryName : none ( ) ,
340+ tag : "v1.2.3-rc.1+build.456" as SemanticVersion ,
341+ checksum : none ( ) ,
342+ } ,
343+ ] ) ,
344+ ) ,
345+ ) ;
346+
347+ test (
348+ "should parse a major version with prerelease and checksum" ,
349+ check (
350+ "foo/bar@v1-beta:sha256-8a4600be96d2ec013209042458ce97a9652fcc46c1c855d0217aa42e330fc06e" ,
351+ ok ( [
352+ {
353+ slug : {
354+ owner : "foo" ,
355+ repository : "bar" ,
356+ } ,
357+ binaryName : none ( ) ,
358+ tag : "v1-beta" as SemanticVersion ,
359+ checksum : some (
360+ "8a4600be96d2ec013209042458ce97a9652fcc46c1c855d0217aa42e330fc06e" as Sha256Hash ,
361+ ) ,
362+ } ,
363+ ] ) ,
364+ ) ,
365+ ) ;
366+
367+ test (
368+ "should parse a major.minor version with prerelease and checksum" ,
369+ check (
370+ "foo/bar@v1.1-beta.123:sha256-8a4600be96d2ec013209042458ce97a9652fcc46c1c855d0217aa42e330fc06e" ,
371+ ok ( [
372+ {
373+ slug : {
374+ owner : "foo" ,
375+ repository : "bar" ,
376+ } ,
377+ binaryName : none ( ) ,
378+ tag : "v1.1-beta.123" as SemanticVersion ,
379+ checksum : some (
380+ "8a4600be96d2ec013209042458ce97a9652fcc46c1c855d0217aa42e330fc06e" as Sha256Hash ,
381+ ) ,
382+ } ,
383+ ] ) ,
384+ ) ,
385+ ) ;
0 commit comments