@@ -10,9 +10,6 @@ class BaseClass:
10
10
11
11
[Boo.Lang.Extensions.Property(ComputedValue)]
12
12
_value as object
13
-
14
- abstract def Foo ():
15
- pass
16
13
17
14
[TestFixture]
18
15
class UnityScriptCompilerTestFixture :
@@ -22,28 +19,29 @@ class UnityScriptCompilerTestFixture:
22
19
[SetUp]
23
20
def SetUpCompiler ():
24
21
compiler = UnityScriptCompiler()
25
-
22
+ compiler .Parameters.Pipeline = UnityScriptCompiler.Pipelines.CompileToMemory()
23
+ compiler .Parameters.ScriptBaseType = BaseClass
24
+ compiler .Parameters.ScriptMainMethod = "Awake"
25
+
26
26
[Test]
27
27
def DefaultCompilerParameters ():
28
28
assert compiler .Parameters.Ducky
29
29
assert CompilerOutputType.Library == compiler .Parameters.OutputType
30
30
31
31
[Test]
32
32
def ScriptBaseTypeAndMainMethod ():
33
- result = CompileScript("ComputedValue = 42;" )
34
- type = result .GeneratedAssembly.GetType("Script" )
33
+ type = CompileScriptType("ComputedValue = 42;" )
35
34
assert BaseClass is type .BaseType
36
35
37
- b as BaseClass = type ()
38
- b .Foo ()
36
+ b as duck = type ()
37
+ b .Awake ()
39
38
assert 42 == b .ComputedValue
40
39
41
40
[Test]
42
41
def ExeEntryPoint ():
43
42
compiler .Parameters.OutputType = CompilerOutputType.ConsoleApplication
44
- result = CompileScript("public static function Main(argv: String[]): void {}" )
45
- generatedAssembly = result .GeneratedAssembly
46
- Assert.AreSame(generatedAssembly .GetType("Script" ).GetMethod("Main" ), generatedAssembly .EntryPoint)
43
+ type = CompileScriptType("public static function Main(argv: String[]): void {}" )
44
+ Assert.AreSame(type .GetMethod("Main" ), type .Assembly.EntryPoint)
47
45
48
46
[Test]
49
47
def ModulesAreAnnotatedWithRawArrayIndexing ():
@@ -68,11 +66,11 @@ class Bar {}
68
66
Assert.IsNull(result .GeneratedAssembly.GetType("Foo" ))
69
67
Assert.IsNotNull(result .GeneratedAssembly.GetType("Bar" ))
70
68
71
- def CompileScript (script as string , * defines as (string )):
72
- compiler .Parameters.Pipeline = UnityScriptCompiler.Pipelines.CompileToMemory()
73
- compiler .Parameters.ScriptBaseType = BaseClass
74
- compiler .Parameters.ScriptMainMethod = "Foo"
69
+ def CompileScriptType (script as string ):
70
+ result = CompileScript(script )
71
+ return result .GeneratedAssembly.GetType("Script" )
75
72
73
+ def CompileScript (script as string , * defines as (string )):
76
74
compiler .Parameters.Input.Clear()
77
75
compiler .Parameters.Input.Add(StringInput("Script" , script ))
78
76
0 commit comments