Marpa

Check-in [6242c71caf]
Login

Check-in [6242c71caf]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Completed testsuite for various support commands.
Timelines: family | ancestors | descendants | both | testsuite-work
Files: files | file ages | folders
SHA1: 6242c71caf499ff6c0cdb9c4dd0ed80f753f4908
User & Date: aku 2017-02-21 05:09:40.004
Context
2017-02-21
05:37
Completed testsuite for standard semantic actions. check-in: 9adb3ce48b user: aku tags: testsuite-work
05:09
Completed testsuite for various support commands. check-in: 6242c71caf user: aku tags: testsuite-work
04:37
Added information about the engine and grammar testsuites. check-in: 3200e8c2d0 user: aku tags: testsuite-work
Changes
Unified Diff Ignore Whitespace Patch
Changes to p_support.tcl.
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
	    -errorcode [linsert $args 0 MARPA @args@] \
	    $msg
    }]]
}

proc marpa::X {msg args} {
    return -code error \
	-errorcode [linsert $args 0 MARPA $args] \
	$msg
}

# # ## ### ##### ######## #############
## Link external command into local namespace

proc marpa::import {cmd {dst {}} {up 2}} {







|







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
	    -errorcode [linsert $args 0 MARPA @args@] \
	    $msg
    }]]
}

proc marpa::X {msg args} {
    return -code error \
	-errorcode [linsert $args 0 MARPA] \
	$msg
}

# # ## ### ##### ######## #############
## Link external command into local namespace

proc marpa::import {cmd {dst {}} {up 2}} {
Name change from tests/todo_support.test to tests/support.test.
10
11
12
13
14
15
16























































































17
18
19
kt require support debug::caller
kt require support oo::util
kt require support TclOO

kt local   testing marpa

# # ## ### ##### ######## ############# #####################
























































































# # ## ### ##### ######## ############# #####################
cleanupTests







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
kt require support debug::caller
kt require support oo::util
kt require support TclOO

kt local   testing marpa

# # ## ### ##### ######## ############# #####################
## - D
## - DX
## - X
## - filter

# # ## ### ##### ######## ############# #####################
## D

test marpa-support-d-1.0 {D, wrong args, not enough} -body {
    marpa D
} -returnCodes error -result {wrong # args: should be "marpa D script"}

test marpa-support-d-1.1 {D, wrong args, not enough} -body {
    marpa D SCRIPT X
} -returnCodes error -result {wrong # args: should be "marpa D script"}

test marpa-support-d-2.0 {D run} -body {
    marpa D {set B 1}
} -cleanup {
    unset B
} -result {}

# # ## ### ##### ######## ############# #####################
## DX

test marpa-support-dx-1.0 {DX, wrong args, not enough} -body {
    marpa DX
} -returnCodes error -result {wrong # args: should be "marpa DX label script"}

test marpa-support-dx-1.1 {DX, wrong args, not enough} -body {
    marpa DX LABEL
} -returnCodes error -result {wrong # args: should be "marpa DX label script"}

test marpa-support-dx-1.2 {DX, wrong args, not enough} -body {
    marpa DX LABEL SCRIPT X
} -returnCodes error -result {wrong # args: should be "marpa DX label script"}

test marpa-support-dx-2.0 {DX run} -body {
    marpa DX foo {set B 1}
} -cleanup {
    unset B
} -result foo

# # ## ### ##### ######## ############# #####################
## X

test marpa-support-x-1.0 {X, wrong args, not enough} -body {
    marpa X
} -returnCodes error -result {wrong # args: should be "marpa X msg ..."}

test marpa-support-x-2.0 {X, message} -body {
    marpa X message
} -returnCodes error -result message

test marpa-support-x-2.1 {X, message} -body {
    catch {
	marpa X message FOO
    } code options
    dict get $options -errorcode
} -cleanup {
    unset code options
} -result {MARPA FOO}

# # ## ### ##### ######## ############# #####################
## filter

test marpa-support-filter-1.0 {filter, wrong args, not enough} -body {
    marpa filter
} -returnCodes error -result {wrong # args: should be "marpa filter values mask"}

test marpa-support-filter-1.1 {filter, wrong args, not enough} -body {
    marpa filter VALUES
} -returnCodes error -result {wrong # args: should be "marpa filter values mask"}

test marpa-support-filter-1.2 {filter, wrong args, not enough} -body {
    marpa filter VALUES MASK X
} -returnCodes error -result {wrong # args: should be "marpa filter values mask"}


test marpa-support-filter-2.0 {filter} -body {
    marpa filter {a b c d e f g} {4 2}
} -result {a b d f g}

test marpa-support-filter-2.1 {filter, badly ordered mask} -body {
    string equal [marpa filter {a b c d e f g} {2 4}] {a b d f g}
    # No error, however a bogus result
} -result 0

# # ## ### ##### ######## ############# #####################
cleanupTests