Changeset 39884 in project


Ignore:
Timestamp:
04/09/21 02:28:26 (5 weeks ago)
Author:
Kon Lovett
Message:

element optional (0), add test for copy/empty/extend

Location:
release/5/semantic-version/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • release/5/semantic-version/trunk/README.svnwiki

    r39865 r39884  
    3535=== make-version
    3636
    37 <procedure>(make-version CNT ELM [CHR]) --> semantic-version</procedure>
     37<procedure>(make-version CNT [ELM CHR]) --> semantic-version</procedure>
    3838
    3939Returns new version with CNT elements, ELM, and punctuation CHR.
    4040
    4141; CNT : {{integer}} ; element count.
    42 ; ELM : {{(or number string symbol)}} ; version element.
     42; ELM : {{(or number string symbol)}} ; version element, default {{0}}.
    4343; CHR : {{char}} ; version punctuation, default is {{(string-ref (version-punctuation) 0)}}.
    4444
     
    186186=== version-depth+!
    187187
    188 <procedure>(version-depth+! VER CNT ELM [CHR]) -> semantic-version</procedure>
     188<procedure>(version-depth+! VER CNT [ELM CHR]) -> semantic-version</procedure>
    189189
    190190Returns VER with more "depth", as ELM, interspersed with CHR.
     
    192192; VER : {{semantic-version}} ; version to extend.
    193193; CNT : {{integer}} ; element count.
    194 ; ELM : {{(or number string symbol)}} ; version element.
     194; ELM : {{(or number string symbol)}} ; version element, default {{0}}.
    195195; CHR : {{char}} ; version punctuation, default is {{(string-ref (version-punctuation) 0)}}.
    196196
     
    207207=== version-depth+
    208208
    209 <procedure>(version-depth+ VER CNT ELM [CHR]) --> semantic-version</procedure>
     209<procedure>(version-depth+ VER CNT [ELM CHR]) --> semantic-version</procedure>
    210210
    211211Returns a copy of VER with more "depth", as ELM, interspersed with CHR.
     
    213213; VER : {{semantic-version}} ; version to extend.
    214214; CNT : {{integer}} ; element count.
    215 ; ELM : {{(or number string symbol)}} ; version element.
     215; ELM : {{(or number string symbol)}} ; version element, default {{0}}.
    216216; CHR : {{char}} ; version punctuation, default is {{(string-ref (version-punctuation) 0)}}.
    217217
  • release/5/semantic-version/trunk/semantic-version.egg

    r39867 r39884  
    33
    44((synopsis "Semantic Version Utilities")
    5  (version "0.0.3")
     5 (version "0.0.4")
    66 (category data)
    77 (author "Kon Lovett")
  • release/5/semantic-version/trunk/semantic-version.scm

    r39869 r39884  
    66;; - Support Roman Numerals & Upper/Lowercase Letters ("outline numbers").
    77;;
    8 ;; - Change representation to record w/ vector "arms".
     8;; - Change representation to vector "arms".
     9;;
     10;; - Better name for `version-depth+/-': `version-depth-extend/retract'?
     11;;
     12;; - Version Protocols: major#.minor#[.point#][;fix#][-reason$]
     13;;   where <alpha>+ name, <separator> char, [] optional ([] & [...[ ]]), # number & $ string
     14;;   w/ both otherwise
    915
    1016(module semantic-version
     
    146152(: version-tail-zero    (#!optional boolean -> boolean))
    147153
    148 (: make-version         (integer ver-part #!optional ver-punc --> ver))
     154(: make-version         (integer #!optional ver-part ver-punc --> ver))
    149155(: version              (#!rest ver-part --> ver))
    150156(: version?             (* -> boolean : ver))
     
    169175(: version-extend!      (ver #!rest (or ver-part ver-punc) -> ver))
    170176(: version-extend       (ver #!rest (or ver-part ver-punc) --> ver))
    171 (: version-depth+!      (ver integer ver-part #!optional ver-punc -> ver))
     177(: version-depth+!      (ver integer #!optional ver-part ver-punc -> ver))
    172178(: version-depth-!      (ver integer -> ver))
    173 (: version-depth+       (ver integer ver-part #!optional ver-punc --> ver))
     179(: version-depth+       (ver integer #!optional ver-part ver-punc --> ver))
    174180(: version-depth-       (ver integer --> ver))
    175181(: version-inc!         (ver #!optional integer number -> ver))
     
    234240  (make-list (sub1 (length parts)) (default-punctuation)) )
    235241
    236 (define (make-version cnt part #!optional (punc (default-punctuation)))
     242(define (make-version cnt #!optional (part 0) (punc (default-punctuation)))
    237243  (check-parts 'make-version (list part))
    238244  (check-puncs 'make-version (list punc))
     
    365371  (apply string-append (map! ->string (version->list (check-version 'version->string ver)))) )
    366372
    367 (define (version-depth+! ver cnt part #!optional (punc (default-punctuation)))
     373(define (version-depth+! ver cnt #!optional (part 0) (punc (default-punctuation)))
    368374  (check-version 'version-depth+! ver)
    369375  (check-parts 'version-depth+! (list part))
     
    391397      (error 'version-depth-! "semantic-version cannot drop negative depth" ver cnt)) ) )
    392398
    393 (define (version-depth+ ver cnt part #!optional (punc (default-punctuation)))
     399(define (version-depth+ ver cnt #!optional (part 0) (punc (default-punctuation)))
    394400  (version-depth+! (copy-ver (check-version 'version-depth+ ver)) cnt part punc) )
    395401
  • release/5/semantic-version/trunk/tests/semantic-version-test.scm

    r39858 r39884  
    1212(import (chicken port) (srfi 69) (srfi 128) semantic-version)
    1313
     14(test "makes empty" (make-version 0) (version))
     15(test "extends empty" (string->version "1.b;ex") (version-extend (version) 1 #\. "b" #\; "ex"))
     16
    1417(test-error (version 'a 2 #\c))
    1518(test-assert (version? (version 'a 2 "c")))
     19
     20(test (version 'a 2 "c") (version-copy (version 'a 2 "c")))
    1621
    1722(test "record print" "#<version \"a.2.c\">" (with-output-to-string (lambda () (display (version 'a 2 "c")))))
Note: See TracChangeset for help on using the changeset viewer.