Beispiel #1
0
 public void ADashCanBeEscaped()
 {
     var handle = new TokenizerHandle(DataMother.GetFile("_scriptNeedingDashEscaping.txt"));
       handle.FastForwardToLine(5);
       var t = handle.ProcessWithToken<AnyToken>();
       t["ZipFileName"].ShouldBeEqualTo("ber-$(currentTag).zip");
 }
Beispiel #2
0
 public void BacktickTokenWorks()
 {
     var handle = new TokenizerHandle(DataMother.GetFile("backtick check.txt"));
       handle.FastForwardToLine(3);
       var t = handle.ProcessWithToken<BacktickToken>();
       t.BackTickValue.ShouldBeEqualTo("echo y| cacls %(Binaries.Identity) /G everyone:R");
 }
Beispiel #3
0
 public void PowershellScriptCallToken()
 {
     var handle = new TokenizerHandle(DataMother.GetFile("_scriptWithPowershellExecAsTask.txt"));
       handle.FastForwardToLine(4);
       var t = handle.ProcessWithToken<PSScriptCallToken>();
       t.ShouldNotBeNull();
       t.Word.ShouldBeEqualTo("MakeFile");
 }
Beispiel #4
0
 public void NodeWithOptionsHasIndexer()
 {
     var handle = new TokenizerHandle(DataMother.GetEmptyProjectFile());
       handle.FastForwardToLine(1);
       var t = handle.ProcessWithToken<ProjectToken>();
       t["DefaultTargets"].ShouldBeEqualTo("Main");
       t["Bla"].ShouldBeNull();
 }
Beispiel #5
0
 public void NodeWithOptionsEscapesDefault()
 {
     var handle = new TokenizerHandle(DataMother.GetFile("node with default needs escaping.txt"));
       handle.FastForwardToLine(1);
       var t = handle.ProcessWithToken<ProjectToken>();
       t["Default"].ShouldBeEqualTo("Default stuff \" Hoho");
       t.Options.Count.ShouldBeEqualTo(4);
 }
Beispiel #6
0
 public void DefaultOptionMapping()
 {
     var handle = new TokenizerHandle(DataMother.NodeWithOptionsVariantB());
       handle.FastForwardToLine(1);
       var t = handle.ProcessWithToken<ProjectToken>();
       t.MapDefaultTo("Option1");
       t["Default"].ShouldBeNull();
       t["Option1"].ShouldNotBeNull();
 }
Beispiel #7
0
        public void NodeWithOptionsWorksAsExpected()
        {
            var handle = new TokenizerHandle(DataMother.GetNodeWithOptions());
              handle.FastForwardToLine(1);
              var t = handle.ProcessWithToken<ProjectToken>();

              t.ShouldNotBeNull();
              t.Options.ShouldHaveCount(4);
              t.Options["Default"].StartsWith("Default").ShouldBeTrue();
              t.Options["Option1"].ShouldBeEqualTo("Bla di Bla");
              t.Options["Option3"].ShouldBeEqualTo("Blablub");
        }
Beispiel #8
0
 public void PowershellScriptToken()
 {
     var handle = new TokenizerHandle(DataMother.GetFile("_scriptWithPowershell.txt"));
       handle.FastForwardToLine(7);
       var t = handle.ProcessWithToken<PSExternalScriptToken>();
       t.ScriptName.ShouldBeEqualTo("smallPNGs");
       t.Script.IndexOf("echo").ShouldBeSmallerThan(5);
       t.Script.Contains("FullName").ShouldBeTrue();
       t.Terminator.ShouldBeEqualTo("END");
 }
Beispiel #9
0
 public void PowershellScriptCallTokenNotMatchingScriptDef()
 {
     var handle = new TokenizerHandle(DataMother.GetFile("_scriptWithPowershell.txt"));
       handle.FastForwardToLine(7);
       var t = handle.ProcessWithToken<PSScriptCallToken>();
       t.ShouldBeNull();
 }
Beispiel #10
0
 public void VariableTokenWorksAsExpected()
 {
     var handle = new TokenizerHandle(DataMother.ProjectAndTarget());
       handle.FastForwardToLine(2);
       var t = handle.ProcessWithToken<VariableToken>();
       t.ShouldNotBeNull();
       t.VariableName.ShouldBeEqualTo("Foo");
       t.Value.ShouldBeEqualTo("Bar Baz");
 }
Beispiel #11
0
        public void TargetTokenWorksAsExpected()
        {
            var handle = new TokenizerHandle(DataMother.ProjectAndTarget());
              handle.FastForwardToLine(3);

              var t = handle.ProcessWithToken<TargetToken>();
              t.ShouldNotBeNull();
              t.Options.ShouldHaveCount(2);
              t.Options["Default"].StartsWith("Default").ShouldBeTrue();
              t.Options["Depends"].StartsWith("Deps").ShouldBeTrue();
        }
Beispiel #12
0
        public void ProjectTokenWorksAsExpectedVariantB()
        {
            var handle = new TokenizerHandle(DataMother.NodeWithOptionsVariantB());
              handle.FastForwardToLine(1);
              var t = handle.ProcessWithToken<ProjectToken>();

              t.ShouldNotBeNull();
              t.Options.Count.ShouldBeEqualTo(3);
        }
Beispiel #13
0
        public void ProjectTokenWorksAsExpected()
        {
            var handle = new TokenizerHandle("Project \"Main\"");
              handle.FastForwardToLine(1);
              var t = handle.ProcessWithToken<ProjectToken>();

              t.ShouldNotBeNull();
              t.Options.Count.ShouldBeEqualTo(1);
              t.Word.ShouldBeEqualTo("Project");
        }
Beispiel #14
0
 public void ProjectTokenDoesNotGobbleOptionsOfTargetToken()
 {
     var handle = new TokenizerHandle(DataMother.ProjectAndTarget());
       handle.FastForwardToLine(1);
       var t = handle.ProcessWithToken<ProjectToken>();
       t.Options.ShouldHaveCount(1);
 }