Test_Quote

Provides unit tests and examples for the Quote lens.

Summary
Test_QuoteProvides unit tests and examples for the Quote lens.
double
double
double_opt
double_opt
double_opt
double_optValue cannot start with a space
single
single
single_opt
single_opt
single_opt
single_optValue cannot start with a space
any
any
any
any_opt
any_opt
any_opt
any_opt
any_optValue cannot start with a space
double_opt_allow_spc
double_opt_allow_spc
quote_spaces
quote_spaces
quote_spacesUnquoted value
quote_spacesdouble quoted value
quote_spacessingle quoted value
quote_spacesunquoted value with spaces
quote_spacesdouble quoted value with spaces
quote_spacessingle quoted value with spaces
quote_spacesremove spaces from double-quoted value
quote_spacesremove spaces from single-quoted value
quote_spacesadd spaces to unquoted value
quote_spacesadd spaces to double-quoted value
quote_spacesadd spaces to single-quoted value
dquote_spaces
dquote_spaces
dquote_spacesUnquoted value
dquote_spacesdouble quoted value
dquote_spacessingle quoted value
dquote_spacesunquoted value with spaces
dquote_spacesdouble quoted value with spaces
dquote_spacessingle quoted value with spaces
dquote_spacesremove spaces from double-quoted value
dquote_spacesadd spaces to unquoted value
dquote_spacesadd spaces to double-quoted value
dquote_spacesadd spaces to single-quoted value
squote_spaces
squote_spaces
squote_spacesUnquoted value
squote_spacesdouble quoted value
squote_spacessingle quoted value
squote_spacesunquoted value with spaces
squote_spacesdouble quoted value with spaces
squote_spacessingle quoted value with spaces
squote_spacesremove spaces from single-quoted value
squote_spacesadd spaces to unquoted value
squote_spacesadd spaces to double-quoted value
squote_spacesadd spaces to single-quoted value
nil cases
dquote_opt_nil
dquote_opt_nil
dquote_opt_nil
dquote_opt_nil
dquote_opt_nil
dquote_opt_nil
dquote_opt_nil
squote_opt_nil
squote_opt_nil
squote_opt_nil
squote_opt_nil
squote_opt_nil
squote_opt_nil
squote_opt_nil
quote_opt_nil
quote_opt_nil
quote_opt_nil
quote_opt_nil
quote_opt_nil
quote_opt_nil
quote_opt_nil

double

let double = [ label "double" . Quote.double ]

double

test double get "\" this is a

double_opt

let double_opt = [ label "double_opt" . Quote.double_opt ]

double_opt

test double_opt get "\"this is a

double_opt

test double_opt get "this is a

double_opt

test double_opt get " this is a

Value cannot start with a space

single

let single = [ label "single" . Quote.single ]

single

test single get "' this is a

single_opt

let single_opt = [ label "single_opt" . Quote.single_opt ]

single_opt

test single_opt get "'this is a

single_opt

test single_opt get "this is a

single_opt

test single_opt get " this is a

Value cannot start with a space

any

let any = [ label "any" . Quote.any ]

any

test any get "\" this is a

any

test any get "' this is a

any_opt

let any_opt = [ label "any_opt" . Quote.any_opt ]

any_opt

test any_opt get "\"this is a

any_opt

test any_opt get "'this is a

any_opt

test any_opt get "this is a

any_opt

test any_opt get " this is a

Value cannot start with a space

double_opt_allow_spc

let double_opt_allow_spc = let body = store /[^\n"]+/ in [ label "double" . Quote.do_dquote_opt body ]

double_opt_allow_spc

test double_opt_allow_spc get "

quote_spaces

quote_spaces

let quote_spaces = Quote.quote_spaces (label "spc")

quote_spaces

test quote_spaces get "this" = { "spc" = "this" }

Unquoted value

quote_spaces

test quote_spaces get "\"this\"" = { "spc" = "this" }

double quoted value

quote_spaces

test quote_spaces get "'this'" = { "spc" = "this" }

single quoted value

quote_spaces

test quote_spaces get "this that those" = *

unquoted value with spaces

quote_spaces

test quote_spaces get "\"this that those\"" = { "spc" = "this that those" }

double quoted value with spaces

quote_spaces

test quote_spaces get "'this that those'" = { "spc" = "this that those" }

single quoted value with spaces

quote_spaces

test quote_spaces put "\"this that those\"" after set "spc" "thisthat" = "\"thisthat\""

remove spaces from double-quoted value

quote_spaces

test quote_spaces put "'this that those'" after set "spc" "thisthat" = "'thisthat'"

remove spaces from single-quoted value

quote_spaces

test quote_spaces put "this" after set "spc" "this that those" = "\"this that those\""

add spaces to unquoted value

quote_spaces

test quote_spaces put "\"this\"" after set "spc" "this that those" = "\"this that those\""

add spaces to double-quoted value

quote_spaces

test quote_spaces put "'this'" after set "spc" "this that those" = "'this that those'"

add spaces to single-quoted value

dquote_spaces

dquote_spaces

let dquote_spaces = Quote.dquote_spaces (label "spc")

dquote_spaces

test dquote_spaces get "this" = { "spc" = "this" }

Unquoted value

dquote_spaces

test dquote_spaces get "\"this\"" = { "spc" = "this" }

double quoted value

dquote_spaces

test dquote_spaces get "'this'" = { "spc" = "'this'" }

single quoted value

dquote_spaces

test dquote_spaces get "this that those" = *

unquoted value with spaces

dquote_spaces

test dquote_spaces get "\"this that those\"" = { "spc" = "this that those" }

double quoted value with spaces

dquote_spaces

test dquote_spaces get "'this that those'" = *

single quoted value with spaces

dquote_spaces

test dquote_spaces put "\"this that those\"" after set "spc" "thisthat" = "\"thisthat\""

remove spaces from double-quoted value

dquote_spaces

test dquote_spaces put "this" after set "spc" "this that those" = "\"this that those\""

add spaces to unquoted value

dquote_spaces

test dquote_spaces put "\"this\"" after set "spc" "this that those" = "\"this that those\""

add spaces to double-quoted value

dquote_spaces

test dquote_spaces put "'this'" after set "spc" "this that those" = "\"this that those\""

add spaces to single-quoted value

squote_spaces

squote_spaces

let squote_spaces = Quote.squote_spaces (label "spc")

squote_spaces

test squote_spaces get "this" = { "spc" = "this" }

Unquoted value

squote_spaces

test squote_spaces get "\"this\"" = { "spc" = "\"this\"" }

double quoted value

squote_spaces

test squote_spaces get "'this'" = { "spc" = "this" }

single quoted value

squote_spaces

test squote_spaces get "this that those" = *

unquoted value with spaces

squote_spaces

test squote_spaces get "\"this that those\"" = *

double quoted value with spaces

squote_spaces

test squote_spaces get "'this that those'" = { "spc" = "this that those" }

single quoted value with spaces

squote_spaces

test squote_spaces put "'this that those'" after set "spc" "thisthat" = "'thisthat'"

remove spaces from single-quoted value

squote_spaces

test squote_spaces put "this" after set "spc" "this that those" = "'this that those'"

add spaces to unquoted value

squote_spaces

test squote_spaces put "\"this\"" after set "spc" "this that those" = "'this that those'"

add spaces to double-quoted value

squote_spaces

test squote_spaces put "'this'" after set "spc" "this that those" = "'this that those'"

add spaces to single-quoted value

nil cases

dquote_opt_nil

let dquote_opt_nil = let body = store Quote.double_opt_re in [ label "dquote_opt_nil" . Quote.do_dquote_opt_nil body ]?

dquote_opt_nil

test dquote_opt_nil get "this" = { "dquote_opt_nil" = "this" }

dquote_opt_nil

test dquote_opt_nil get "'this'" = { "dquote_opt_nil" = "'this'" }

dquote_opt_nil

test dquote_opt_nil get "\"this\"" = { "dquote_opt_nil" = "this" }

dquote_opt_nil

test dquote_opt_nil put "" after set "dquote_opt_nil" "this" = "this"

dquote_opt_nil

test dquote_opt_nil put "\"this\"" after set "dquote_opt_nil" "this" = "\"this\""

dquote_opt_nil

test dquote_opt_nil put "'this'" after set "dquote_opt_nil" "this" = "this"

squote_opt_nil

let squote_opt_nil = let body = store Quote.single_opt_re in [ label "squote_opt_nil" . Quote.do_squote_opt_nil body ]?

squote_opt_nil

test squote_opt_nil get "this" = { "squote_opt_nil" = "this" }

squote_opt_nil

test squote_opt_nil get "'this'" = { "squote_opt_nil" = "this" }

squote_opt_nil

test squote_opt_nil get "\"this\"" = { "squote_opt_nil" = "\"this\"" }

squote_opt_nil

test squote_opt_nil put "" after set "squote_opt_nil" "this" = "this"

squote_opt_nil

test squote_opt_nil put "\"this\"" after set "squote_opt_nil" "this" = "this"

squote_opt_nil

test squote_opt_nil put "\"this\"" after set "squote_opt_nil" "this" = "this"

quote_opt_nil

let quote_opt_nil = let body = store Quote.any_opt_re in [ label "quote_opt_nil" . Quote.do_quote_opt_nil body ]?

quote_opt_nil

test quote_opt_nil get "this" = { "quote_opt_nil" = "this" }

quote_opt_nil

test quote_opt_nil get "'this'" = { "quote_opt_nil" = "this" }

quote_opt_nil

test quote_opt_nil get "\"this\"" = { "quote_opt_nil" = "this" }

quote_opt_nil

test quote_opt_nil put "" after set "quote_opt_nil" "this" = "this"

quote_opt_nil

test quote_opt_nil put "\"this\"" after set "quote_opt_nil" "this" = "\"this\""

quote_opt_nil

test quote_opt_nil put "'this'" after set "quote_opt_nil" "this" = "'this'"
Generic module providing useful primitives for quoting
let double = [ label "double" . Quote.double ]
let double_opt = [ label "double_opt" . Quote.double_opt ]
let single = [ label "single" . Quote.single ]
let single_opt = [ label "single_opt" . Quote.single_opt ]
let any = [ label "any" . Quote.any ]
let any_opt = [ label "any_opt" . Quote.any_opt ]
let double_opt_allow_spc = let body = store /[^\n"]+/ in [ label "double" . Quote.do_dquote_opt body ]
let quote_spaces = Quote.quote_spaces (label "spc")
let dquote_spaces = Quote.dquote_spaces (label "spc")
let squote_spaces = Quote.squote_spaces (label "spc")
let dquote_opt_nil = let body = store Quote.double_opt_re in [ label "dquote_opt_nil" . Quote.do_dquote_opt_nil body ]?
let squote_opt_nil = let body = store Quote.single_opt_re in [ label "squote_opt_nil" . Quote.do_squote_opt_nil body ]?
let quote_opt_nil = let body = store Quote.any_opt_re in [ label "quote_opt_nil" . Quote.do_quote_opt_nil body ]?
Close