// NAnt - A .NET build tool
// Copyright (C) 2002-2003 Scott Hernandez (ScottHernandez@hotmail.com)
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Scott Hernandez (ScottHernandez@hotmail.com)
using System;
using System.IO;
using System.Reflection;
using System.Text;
using System.Xml;
using NAnt.Core;
using NUnit.Framework;
namespace Tests.NAnt.Core.Tasks {
[TestFixture]
public class ScriptTest : BuildTestBase {
[Test]
[Category ("NotMono")]
public void Test_VB() {
string _xml = @"
";
string result = RunBuild(_xml);
Assert.IsTrue(result.IndexOf("CSFoo=1") != -1, "VB script should have updated prop." + Environment.NewLine + result);
}
[Test]
public void Test_CSharp() {
string _xml = @"
";
string result = RunBuild(_xml);
Assert.IsTrue(result.IndexOf("Hello") != -1, "CSharp script should written something." + Environment.NewLine + result);
Assert.IsTrue(result.IndexOf("script.me") != -1, "CSharp script should have updated prop." + Environment.NewLine + result);
}
///
/// Test for bug #1187957.
///
[Test]
public void Test_Tasks() {
const string _xml = @"
";
RunBuild(_xml);
}
[Test]
public void Test_Functions() {
string _xml = @"
";
Project project = CreateFilebasedProject(_xml);
string result = ExecuteProject(project);
Assert.IsNotNull(TypeFactory.LookupFunction("script::test-func", project),
"Function script should have defined a new custom function #1." + Environment.NewLine + result);
Assert.IsNotNull(TypeFactory.LookupFunction("whatever::test", project),
"Function script should have defined a new custom function #2." + Environment.NewLine + result);
Assert.IsTrue(result.IndexOf("some result") != -1,
"Function script should written something #1." + Environment.NewLine + result);
Assert.IsTrue(result.IndexOf("some other result") != -1,
"Function script should written something #2." + Environment.NewLine + result);
}
[Test]
public void Test_2ScriptsInOneProject() {
string _xml = @"
";
RunBuild(_xml);
}
}
}