Run() public method

public Run ( CompilerContext context ) : void
context CompilerContext
return void
Exemplo n.º 1
0
		public void EventSequence()
		{
			var calls = new List<string>();
			var pipeline = new CompilerPipeline();
			pipeline.Before += delegate { calls.Add("before"); };
			pipeline.BeforeStep += delegate { calls.Add("before step"); };
			pipeline.Add(new ActionStep(() => calls.Add("step")));
			pipeline.AfterStep += delegate { calls.Add("after step"); };
			pipeline.After += delegate { calls.Add("after"); };
			pipeline.Run(new CompilerContext());
			Assert.AreEqual(
				new string[] {"before", "before step", "step", "after step", "after"},
				calls.ToArray());
		}
Exemplo n.º 2
0
		public void CurrentStep()
		{
			var pipeline = new CompilerPipeline();

			var step1 = new ActionStep(delegate {});
			pipeline.Add(step1);

			ActionStep step2 = null;
			step2 = new ActionStep(() => Assert.AreSame(step2, pipeline.CurrentStep));
			pipeline.Add(step2);

			var currentSteps = new Boo.Lang.List();
			pipeline.Before += (sender, args) => currentSteps.Add(pipeline.CurrentStep);
			pipeline.BeforeStep += (sender, args) => currentSteps.Add(pipeline.CurrentStep);
			pipeline.AfterStep += (sender, args) => currentSteps.Add(pipeline.CurrentStep);
			pipeline.After += (sender, args) => currentSteps.Add(pipeline.CurrentStep);

			pipeline.Run(new CompilerContext());

			Assert.AreEqual(
				new object[] { null, step1, step1, step2, step2, null },
				currentSteps.ToArray());
		}
Exemplo n.º 3
0
		public void ExecutionOrder()
		{
			var order = new List<string>();
			var p1 = new ActionStep(() => order.Add("p1"));
			var p2 = new ActionStep(() => order.Add("p2"));

			var pipeline = new CompilerPipeline { p1, p2 };
			pipeline.Run(new CompilerContext());

			Assert.AreEqual(new[] { "p1", "p2" }, order.ToArray());
		}