| |
952 |
952 |
set handle [:protected forward "foo 3" string cat %method] |
| |
953 |
953 |
? [list info commands $handle] $handle |
| |
954 |
954 |
set handle [:private forward "foo 4" string cat %method] |
| |
955 |
955 |
? [list info commands $handle] $handle |
| |
956 |
956 |
set handle [:object forward "foo 5" string cat %method] |
| |
957 |
957 |
? [list info commands $handle] $handle |
| |
958 |
958 |
set handle [:public object forward "foo 6" string cat %method] |
| |
959 |
959 |
? [list info commands $handle] $handle |
| |
960 |
960 |
set handle [:protected object forward "foo 7" string cat %method] |
| |
961 |
961 |
? [list info commands $handle] $handle |
| |
962 |
962 |
set handle [:private object forward "foo 8" string cat %method] |
| |
963 |
963 |
? [list info commands $handle] $handle |
| |
964 |
964 |
}] |
| |
965 |
965 |
|
| |
966 |
966 |
? [list $C foo 6] "6" |
| |
967 |
967 |
? [list $C foo 5] "unable to dispatch sub-method \"5\" of $C foo; valid are: foo 6" |
| |
968 |
968 |
? [list $C eval {:foo 5}] "5" |
| |
969 |
969 |
? [list $C foo 7] "unable to dispatch sub-method \"7\" of $C foo; valid are: foo 6" |
| |
970 |
970 |
? [list $C eval {:foo 7}] "7" |
| |
971 |
971 |
? [list $C foo 8] "unable to dispatch sub-method \"8\" of $C foo; valid are: foo 6" |
| |
972 |
|
? [list $C eval {:foo 8}] "8"; # ! should not be possible ! |
| |
|
972 |
? [list $C eval {:foo 8}] "unable to dispatch sub-method \"8\" of $C foo; valid are: foo 6"; |
| |
|
973 |
? [list $C eval {: -local foo 8}] "8"; |
| |
973 |
974 |
|
| |
974 |
975 |
set c [$C new] |
| |
975 |
976 |
|
| |
976 |
977 |
? [list $c foo 2] "2" |
| |
977 |
978 |
? [list $c foo 1] "unable to dispatch sub-method \"1\" of $c foo; valid are: foo 2" |
| |
978 |
979 |
? [list $c eval {:foo 1}] "1" |
| |
979 |
980 |
? [list $c foo 3] "unable to dispatch sub-method \"3\" of $c foo; valid are: foo 2" |
| |
980 |
981 |
? [list $c eval {:foo 3}] "3" |
| |
981 |
982 |
? [list $c foo 4] "unable to dispatch sub-method \"4\" of $c foo; valid are: foo 2" |
| |
982 |
|
? [list $c eval {:foo 4}] "4"; # ! should not be possible ! |
| |
|
983 |
? [list $c eval {:foo 4}] "unable to dispatch sub-method \"4\" of $c foo; valid are: foo 2"; |
| |
|
984 |
? [list $c eval {: -local foo 4}] "4"; |
| |
983 |
985 |
|
| |
984 |
986 |
} |
| |
985 |
987 |
|
| |
|
988 |
nx::test case ensemble-private-helper { |
| |
|
989 |
|
| |
|
990 |
nx::Class create B { |
| |
|
991 |
:public method "bar 1" {} {return [list B.bar.1 {*}[next]]} |
| |
|
992 |
:public method "baz 1" {} {return [list B.baz.1 {*}[next]]} |
| |
|
993 |
:create b1 { |
| |
|
994 |
:public object method foo {} {: -local bar 1} |
| |
|
995 |
:public object method foo2 {} {:bar 1} |
| |
|
996 |
:private object method "bar 1" {} {: -local baz 1} |
| |
|
997 |
:private object method "baz 1" {} {return [list "b1.baz.1" {*}[next]]} |
| |
|
998 |
} |
| |
|
999 |
} |
| |
|
1000 |
nx::Class create C -superclass B { |
| |
|
1001 |
:public method "bar 1" {} {return [list C.bar.1 {*}[next]]} |
| |
|
1002 |
:public method "baz 1" {} {return [list C.baz.1 {*}[next]]} |
| |
|
1003 |
:create c1 { |
| |
|
1004 |
:public object method foo {} {: -local bar 1} |
| |
|
1005 |
:public object method foo2 {} {:bar 1} |
| |
|
1006 |
:private object method "bar 1" {} {: -local baz 1} |
| |
|
1007 |
:private object method "baz 1" {} {return [list "c1.baz.1" {*}[next]]} |
| |
|
1008 |
} |
| |
|
1009 |
} |
| |
|
1010 |
|
| |
|
1011 |
? {b1 bar 1} "B.bar.1" |
| |
|
1012 |
? {b1 baz 1} "B.baz.1" |
| |
|
1013 |
? {b1 foo} "b1.baz.1 B.baz.1" |
| |
|
1014 |
? {b1 foo2} "B.bar.1" |
| |
|
1015 |
|
| |
|
1016 |
? {c1 bar 1} "C.bar.1 B.bar.1" |
| |
|
1017 |
? {c1 baz 1} "C.baz.1 B.baz.1" |
| |
|
1018 |
? {c1 foo} "c1.baz.1 C.baz.1 B.baz.1" |
| |
|
1019 |
? {c1 foo2} "C.bar.1 B.bar.1" |
| |
|
1020 |
} |
| |
|
1021 |
|
| |
|
1022 |
nx::test case ensemble-private-local-checks { |
| |
|
1023 |
|
| |
|
1024 |
nx::Class create B { |
| |
|
1025 |
:public method "bar 1" {} {return [list B.bar.1 {*}[next]]} |
| |
|
1026 |
:public method "bar 2" {} {return [list B.bar.2 {*}[next]]} |
| |
|
1027 |
:public method FOO1 {} {: -local bar 1} |
| |
|
1028 |
:public method FOO2 {} {:bar 1} |
| |
|
1029 |
:public method "FOO3 FAR FIM" {} {: -local bar 1} |
| |
|
1030 |
:create b1 { |
| |
|
1031 |
:public object method foo {} {: -local bar 1} |
| |
|
1032 |
:public object method faa {} {: -local noop 2} |
| |
|
1033 |
:public object method fee1 {} {: -local bar 2} |
| |
|
1034 |
:public object method fee2 {} {: -local bar 3} |
| |
|
1035 |
:private object method "bar 1" {} {: -local baz 1} |
| |
|
1036 |
:private object method "baz 1" {} {return "b1.baz.1"} |
| |
|
1037 |
} |
| |
|
1038 |
} |
| |
|
1039 |
nx::Class create C -superclass B { |
| |
|
1040 |
:public method "bar 1" {} {return [list C.bar.1 {*}[next]]} |
| |
|
1041 |
:public method "baz 1" {} {return [list C.baz.1 {*}[next]]} |
| |
|
1042 |
:create c1 { |
| |
|
1043 |
:public object method foo {} {: -local bar 1} |
| |
|
1044 |
:public object method faa {} {: -local noop 2} |
| |
|
1045 |
:public object method fee1 {} {: -local bar 2} |
| |
|
1046 |
:public object method fee2 {} {: -local bar 3} |
| |
|
1047 |
:private object method "bar 1" {} {: -local baz 1} |
| |
|
1048 |
:private object method "baz 1" {} {return "c1.baz.1"} |
| |
|
1049 |
} |
| |
|
1050 |
} |
| |
|
1051 |
|
| |
|
1052 |
? {b1 faa} "::b1: unable to dispatch method 'noop'" |
| |
|
1053 |
? {b1 foo} "b1.baz.1" |
| |
|
1054 |
? {b1 fee1} "B.bar.2" |
| |
|
1055 |
? {b1 fee2} "unable to dispatch sub-method \"3\" of ::b1 bar; valid are: bar 1, bar 2" |
| |
|
1056 |
? {b1 FOO1} "B.bar.1" |
| |
|
1057 |
? {b1 FOO2} "B.bar.1" |
| |
|
1058 |
? {b1 FOO3 FAR FIM} "B.bar.1" |
| |
|
1059 |
|
| |
|
1060 |
? {c1 faa} "::c1: unable to dispatch method 'noop'" |
| |
|
1061 |
? {c1 foo} "c1.baz.1" |
| |
|
1062 |
? {c1 fee1} "B.bar.2" |
| |
|
1063 |
? {c1 fee2} "unable to dispatch sub-method \"3\" of ::c1 bar; valid are: bar 1, bar 2" |
| |
|
1064 |
? {c1 FOO1} "B.bar.1" |
| |
|
1065 |
? {c1 FOO2} "C.bar.1 B.bar.1" |
| |
|
1066 |
? {c1 FOO3 FAR FIM} "B.bar.1" |
| |
|
1067 |
|
| |
|
1068 |
} |
| |
|
1069 |
|
| |
986 |
1070 |
# |
| |
987 |
1071 |
# Local variables: |
| |
988 |
1072 |
# mode: tcl |
| |
989 |
1073 |
# tcl-indent-level: 2 |
| |
990 |
1074 |
# indent-tabs-mode: nil |
| |
991 |
1075 |
# End: |