diff --git a/samples/d.d b/samples/d.d new file mode 100644 index 0000000..d271a16 --- /dev/null +++ b/samples/d.d @@ -0,0 +1,100 @@ +/* + * Some block commments + * go here + */ + +/+ + + Nesting comment + +/ + +/// A single line documentation comment +module net.masterthought.cucumber.report_information; + +import std.algorithm; +import std.array; +import std.string; +import std.conv : to; // line comment about this import + +import jsonizer.tojson; +import net.masterthought.cucumber.report_parser; + +/** + * A documentation comment + */ +@safe: +class ReportInformation +{ + + deprecated string originalId = "Some text\twith a gap"; + + string runId = `Some \n Text`; + + string anotherId = "\¶\U0001F603"; // ¶😃 + + Feature[] features; + + private auto symbol = '£'; + + private string m_name; + @property string name() + { + return m_name; + } + + this(ReportParser parser) + { + this.runId = parser.getRunId(); + this.features = parser.getReports().map!(report => report.getFeatures()).joiner.array; + } + + private Feature[] processFeatures(Feature[] features) + { + return features.map!((f) { + f.featureInformation = calculateFeatureInformation(f); + f.scenarios = addScenarioInformation(f); + return f; + }).array; + } + + public auto getTotalNumberOfBackgroundScenariosUnknown() + { + return features.map!(f => f.getBackgroundScenariosUnknown().length).sum; + } +} + +struct +{ + string name; +} + +union +{ + string day; +} + +unittest +{ + // load test json from file + auto testJson = to!string(read("src/test/resources/project1.json")); + string runId = "run 1"; + ReportInformation ri = new ReportInformation(new ReportParser(runId, [ + testJson + ])); + + assert(ri.name != null); + // should have correct number of features + ri.getFeatures().length.assertEqual(2); + + // overall status + ri.getOverallStatus.assertEqual(to!string(Status.Failed)); + + // feature totals + Feature feature = ri.getFeatures().front; + +} + +T foo(T, E: + Exception)(Node node, in string path) +{ + return node.bar!(T, E)(path); +} diff --git a/samples/sdl.sdl b/samples/sdl.sdl new file mode 100644 index 0000000..c9f4309 --- /dev/null +++ b/samples/sdl.sdl @@ -0,0 +1,34 @@ +// This is a node with a single string value +title "Hello, World" + +// Multiple values are supported, too +bookmarks 12 15 188 1234 + +// Nodes can have attributes +author "Peter Parker" email="peter@example.org" active=true + +// Nodes can be arbitrarily nested +contents { + section "First section" { + paragraph "This is the first paragraph" + paragraph "This is the second paragraph" + } +} + +// Anonymous nodes are supported +"This text is the value of an anonymous node!" + +// This makes things like matrix definitions very convenient +matrix { + 1 0 0 + 0 1 0 + 0 0 1 +} + +foo 2013/2/22 07:53:34.123-GMT+05:30 bar=null + +xml ` + + + +`