Changeset 35170 in project


Ignore:
Timestamp:
02/20/18 06:54:26 (7 months ago)
Author:
kon
Message:

add tests , better names , bump ver

Location:
release/4/posix-utils/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/4/posix-utils/trunk/posix-utils.scm

    r35169 r35170  
    1212  string-trim-eol software-eol-string
    1313  ;
    14   qs* qs-quote qs-evaluate qs-argument
     14  qs* qs-literal qs-string qs-argument
     15  ;
     16  get-commandline-result
     17  get-command-result
     18  get-echo-result
    1519  ;
    1620  environment-string environment-variables->environment-list
     21  ;
     22  get-shell-variable
    1723  ;
    1824  environment-variable-bound?
     
    2026  register-environment-variable-feature!
    2127  ;
    22   get-commandline-result
    23   get-command-result get-echo-result
    24   ;
    25   get-shell-variable
    2628  shell-variable-bound?
    2729  shell-variable-true?
     
    119121    (string-append delim str delim) ) )
    120122
    121 (: qs-quote (* -> string))
    122 ;
    123 (define (qs-quote item)
    124   (qs-argument item #t SINGLE-QUOTE)
    125   #;
    126   (qs-argument (quote item)) )
    127 
    128 (: qs-evaluate (* -> string))
    129 ;
    130 (define (qs-evaluate item)
    131   (qs-argument item #t DOUBLE-QUOTE)
    132   #;
    133   (qs-argument (quasiquote (unquote item))) )
     123(: qs-literal (* -> string))
     124;
     125(define (qs-literal item)
     126  (qs-argument item #t SINGLE-QUOTE) )
     127
     128(: qs-string (* -> string))
     129;
     130(define (qs-string item)
     131  (qs-argument item #t DOUBLE-QUOTE) )
    134132
    135133(: qs-argument (* #!optional boolean (or string char) -> string))
     
    178176  (qs-unquote item #t) )
    179177
     178(: qs-unquoted (string --> string))
     179;
     180(define qs-unquoted (o ->string eval))
     181
    180182(: qs-unquote (* #!optional boolean --> string))
    181183;
     
    184186    (evaled
    185187      (if (and splicing? (list? item))
    186         (string-intersperse (map ->string item) " ")
    187         (->string item) ) ) )
     188        (string-intersperse (map qs-unquoted item) " ")
     189        (qs-unquoted item) ) ) )
    188190    (qs-argument evaled #t DOUBLE-QUOTE) ) )
    189191
  • release/4/posix-utils/trunk/posix-utils.setup

    r35168 r35170  
    55(verify-extension-name "posix-utils")
    66
    7 (setup-shared-extension-module 'posix-utils (extension-version "1.1.1")
     7(setup-shared-extension-module 'posix-utils (extension-version "1.2.0")
    88  #:compile-options '(
    99    -fixnum-arithmetic
  • release/4/posix-utils/trunk/tests/posix-utils-test.scm

    r35169 r35170  
    2323  (test "\"foo\"" (qs* "foo"))
    2424  (test "'foo'" (qs* "foo" #\'))
    25   (test "\"$((1 + 2))\"" (qs-evaluate "$((1 + 2))"))
    26   (test "'$((1 + 2))'" (qs-quote "$((1 + 2))"))
     25  (test "\"$((1 + 2))\"" (qs-string "$((1 + 2))"))
     26  (test "'$((1 + 2))'" (qs-literal "$((1 + 2))"))
    2727  (test "'$((1 + 2))'" (qs-argument '(quote "$((1 + 2))")))
    2828  ;(test "`\"$ ((1 + 2))\"`" (qs-argument '`,@($(( 1 + 2 )))))
    2929  (test "`\"\"`" (qs-argument '`,@()))
    30   (test "`\"result is 3\"`" (qs-argument '`,@(result is 3)))
    31   (test "`\"3\"`" (qs-argument '`,3))
     30  (test "`\"result is 3\"`" (qs-argument '`,@("result is" (+ 1 2))))
     31  (test "`\"3\"`" (qs-argument '`,(+ 1 2)))
    3232)
    3333
Note: See TracChangeset for help on using the changeset viewer.