Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
703e090
commit 8cab6d1
Showing
29 changed files
with
335 additions
and
312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,26 @@ | ||
// Copyright © 2011 Syterra Software Inc. | ||
// Copyright © 2016 Syterra Software Inc. | ||
// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. | ||
// 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. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using fitSharp.Fit.Application; | ||
using fitSharp.Fit.Runner; | ||
using fitSharp.IO; | ||
using fitSharp.Machine.Application; | ||
using fitSharp.Machine.Engine; | ||
|
||
namespace fit.Runner { | ||
public class FolderRunner: Runnable { | ||
|
||
public int Run(IList<string> commandLineArguments, Memory memory, ProgressReporter reporter) { | ||
var now = DateTime.Now; | ||
myProgressReporter = reporter; | ||
var result = Run(memory, commandLineArguments); | ||
//todo: to suiterunner? | ||
if (!memory.GetItem<Settings>().DryRun) | ||
reporter.Write(string.Format("\n{0}, time: {1}\n", Results, DateTime.Now - now)); | ||
return result; | ||
public FolderRunner() { | ||
runner = new fitSharp.Fit.Runner.SuiteRunnerShell(); | ||
} | ||
|
||
public string Results {get { return myRunner.TestCounts.Description; }} | ||
|
||
|
||
ProgressReporter myProgressReporter; | ||
SuiteRunner myRunner; | ||
string selectedFile; | ||
|
||
int Run(Memory memory, IList<string> arguments) { | ||
ParseArguments(memory, arguments); | ||
var fileSystem = new FileSystemModel(memory.GetItem<Settings>().CodePageNumber); | ||
memory.GetItem<Context>().PageSource = fileSystem; | ||
memory.GetItem<Context>().SuitePath = new DirectoryPath(memory.GetItem<Settings>().InputFolder); | ||
myRunner = new SuiteRunner(memory, myProgressReporter); | ||
myRunner.Run( | ||
CreateStoryTestFolder(memory, fileSystem), | ||
selectedFile); | ||
return myRunner.TestCounts.FailCount; | ||
} | ||
|
||
void ParseArguments(Memory memory, IList<string> arguments) { | ||
if (arguments.Count == 0) { | ||
return; | ||
} | ||
var argumentParser = new ArgumentParser(); | ||
argumentParser.AddSwitchHandler("d", () => memory.GetItem<Settings>().DryRun = true); | ||
argumentParser.AddArgumentHandler("i", value => memory.GetItem<Settings>().InputFolder = value); | ||
argumentParser.AddArgumentHandler("o", value => memory.GetItem<Settings>().OutputFolder = value); | ||
argumentParser.AddArgumentHandler("s", value => selectedFile = value); | ||
argumentParser.AddArgumentHandler("x", value => memory.GetItem<FileExclusions>().AddRange(value.Split(';'))); | ||
argumentParser.AddArgumentHandler("t", value => memory.GetItem<Settings>().TagList = value); | ||
|
||
argumentParser.Parse(arguments); | ||
if (memory.GetItem<Settings>().InputFolder == null) | ||
throw new FormatException("Missing input folder"); | ||
if (memory.GetItem<Settings>().OutputFolder == null) | ||
throw new FormatException("Missing output folder"); | ||
public int Run(IList<string> commandLineArguments, Memory memory, ProgressReporter reporter) { | ||
return runner.Run(commandLineArguments, memory, reporter, m => new Service.Service(m)); | ||
} | ||
|
||
StoryTestFolder CreateStoryTestFolder(Memory memory, FolderModel folderModel) { | ||
var storyTestFolder = new StoryTestFolder(memory, folderModel); | ||
|
||
string tagList = memory.GetItem<Settings>().TagList; | ||
if (!string.IsNullOrEmpty(tagList)) | ||
storyTestFolder.AddPageFilter(new TagFilter(tagList)); | ||
public string Results { get { return runner.Results; } } | ||
|
||
return storyTestFolder; | ||
} | ||
readonly fitSharp.Fit.Runner.SuiteRunnerShell runner; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright © 2016 Syterra Software Inc. All rights reserved. | ||
// The use and distribution terms for this software are covered by the Common Public License 1.0 (http://opensource.org/licenses/cpl.php) | ||
// which can be found in the file license.txt at the root of this distribution. By using this software in any fashion, you are agreeing | ||
// to be bound by the terms of this license. You must not remove this notice, or any other, from this software. | ||
|
||
using fitSharp.Fit.Engine; | ||
using fitSharp.Fit.Model; | ||
using fitSharp.Machine.Application; | ||
using fitSharp.Machine.Engine; | ||
using fitSharp.Machine.Model; | ||
using fitSharp.Parser; | ||
|
||
namespace fitSharp.Fit.Operators { | ||
public class ComposeStoryTestString: CellOperator, ComposeOperator<Cell> { | ||
public bool CanCompose(TypedValue instance) { | ||
return instance.Type == typeof(StoryTestString); | ||
} | ||
|
||
public Tree<Cell> Compose(TypedValue instance) { | ||
var storyTestInput = instance.ValueString; | ||
if (storyTestInput.Contains(Characters.TextStoryTestBegin)) { | ||
return new TextTables( | ||
new TextTableScanner(instance.ValueString, c => c == CharacterType.Letter), | ||
MakeTreeCell) | ||
.Parse(); | ||
} | ||
else { | ||
HtmlString.IsStandard = Processor.Get<Settings>().IsStandard; | ||
return new HtmlTables(MakeTreeCell).Parse(instance.ValueString); | ||
} | ||
} | ||
|
||
Tree<Cell> MakeTreeCell(string text) { | ||
return Processor.MakeCell(text, string.Empty, new TreeList<Cell>[] {}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright © 2016 Syterra Software Inc. All rights reserved. | ||
// The use and distribution terms for this software are covered by the Common Public License 1.0 (http://opensource.org/licenses/cpl.php) | ||
// which can be found in the file license.txt at the root of this distribution. By using this software in any fashion, you are agreeing | ||
// to be bound by the terms of this license. You must not remove this notice, or any other, from this software. | ||
|
||
using System.Collections.Generic; | ||
using fitSharp.Fit.Operators; | ||
using fitSharp.Fit.Service; | ||
using fitSharp.IO; | ||
using fitSharp.Machine.Application; | ||
using fitSharp.Machine.Engine; | ||
|
||
namespace fitSharp.Fit.Runner { | ||
public class FolderRunner: Runnable { | ||
|
||
public FolderRunner() { | ||
runner = new SuiteRunnerShell(); | ||
} | ||
|
||
public int Run(IList<string> commandLineArguments, Memory memory, ProgressReporter reporter) { | ||
return runner.Run(commandLineArguments, memory, reporter, m => new CellProcessorBase(m, m.GetItem<CellOperators>())); | ||
} | ||
|
||
public string Results { get { return runner.Results; } } | ||
|
||
readonly SuiteRunnerShell runner; | ||
} | ||
} |
Oops, something went wrong.