-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTestMethod.sc
67 lines (60 loc) · 1.22 KB
/
TestMethod.sc
1
2
3
4
5
6
7
8
9
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
/*
TestMethod.run
UnitTest.gui
*/
TestMethod : UnitTest {
test_method_argumentString {
var methodsThatFailed = List.new;
Object.allSubclasses.do({ arg item;
item.methods.do({ arg jtem;
var method = jtem;
try {
method.argumentString;
} {|err|
".argumentString FAILED for: %".format(method.asString).postln;
methodsThatFailed.add(method);
}
});
});
this.assert(
methodsThatFailed.size == 0,
"The method argumentString failed for % methods".format(methodsThatFailed.size)
);
}
test_classnameAsMethodCrash {
try
{
1 fooBar: 2;
}
{
|error|
"1 fooBar: 2 threw an exception (no method)".postln;
error.errorString.postln;
};
try
{
1 FooBar: 2;
}
{
|error|
"1 FooBar: 2 threw an exception (FooBar is not a method)".postln;
error.errorString.postln;
};
if( Main.versionAtLeast( 3, 8 ),
{
try
{
1 Object: 2;
}
{
|error|
"1 Object: 2 threw an exception (Object is a class not a method)".postln;
error.errorString.postln;
};
},
{
"Don't test '1 Object: 2' until rev 3.8 at least (Issue #669)".postln;
}
);
}
} // End class