Exemple #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");
 }
Exemple #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");
 }
Exemple #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");
 }
Exemple #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();
 }
Exemple #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);
 }
Exemple #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();
 }
Exemple #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");
        }
Exemple #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");
 }
Exemple #9
0
 public void PowershellScriptCallTokenNotMatchingScriptDef()
 {
     var handle = new TokenizerHandle(DataMother.GetFile("_scriptWithPowershell.txt"));
       handle.FastForwardToLine(7);
       var t = handle.ProcessWithToken<PSScriptCallToken>();
       t.ShouldBeNull();
 }
Exemple #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");
 }
Exemple #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();
        }
Exemple #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);
        }
Exemple #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");
        }
Exemple #14
0
 public void ProjectTokenDoesNotGobbleOptionsOfTargetToken()
 {
     var handle = new TokenizerHandle(DataMother.ProjectAndTarget());
       handle.FastForwardToLine(1);
       var t = handle.ProcessWithToken<ProjectToken>();
       t.Options.ShouldHaveCount(1);
 }