purs-pkg-deps
Version:
Query package dependencies in PureScript package-sets
182 lines (181 loc) • 12.1 kB
JavaScript
// Generated by purs version 0.14.3
;
var Control_Applicative = require("../Control.Applicative/index.js");
var Control_Bind = require("../Control.Bind/index.js");
var Control_Monad_State_Class = require("../Control.Monad.State.Class/index.js");
var Control_Monad_State_Trans = require("../Control.Monad.State.Trans/index.js");
var Control_Monad_Writer_Trans = require("../Control.Monad.Writer.Trans/index.js");
var Data_Array = require("../Data.Array/index.js");
var Data_Function = require("../Data.Function/index.js");
var Data_Generic_Rep = require("../Data.Generic.Rep/index.js");
var Data_Identity = require("../Data.Identity/index.js");
var Data_Int = require("../Data.Int/index.js");
var Data_Map_Internal = require("../Data.Map.Internal/index.js");
var Data_Maybe = require("../Data.Maybe/index.js");
var Data_Monoid = require("../Data.Monoid/index.js");
var Data_Ord = require("../Data.Ord/index.js");
var Data_Show = require("../Data.Show/index.js");
var Data_Show_Generic = require("../Data.Show.Generic/index.js");
var Data_Symbol = require("../Data.Symbol/index.js");
var Data_Unit = require("../Data.Unit/index.js");
var Test_Spec_Console = require("../Test.Spec.Console/index.js");
var Test_Spec_Reporter_Base = require("../Test.Spec.Reporter.Base/index.js");
var Test_Spec_Result = require("../Test.Spec.Result/index.js");
var Test_Spec_Runner_Event = require("../Test.Spec.Runner.Event/index.js");
var Test_Spec_Speed = require("../Test.Spec.Speed/index.js");
var Test_Spec_Style = require("../Test.Spec.Style/index.js");
var Test_Spec_Tree = require("../Test.Spec.Tree/index.js");
var PrintSuite = (function () {
function PrintSuite(value0) {
this.value0 = value0;
};
PrintSuite.create = function (value0) {
return new PrintSuite(value0);
};
return PrintSuite;
})();
var PrintTest = (function () {
function PrintTest(value0, value1) {
this.value0 = value0;
this.value1 = value1;
};
PrintTest.create = function (value0) {
return function (value1) {
return new PrintTest(value0, value1);
};
};
return PrintTest;
})();
var PrintPending = (function () {
function PrintPending(value0) {
this.value0 = value0;
};
PrintPending.create = function (value0) {
return new PrintPending(value0);
};
return PrintPending;
})();
var printActionGeneric = new Data_Generic_Rep.Generic(function (x) {
if (x instanceof PrintSuite) {
return new Data_Generic_Rep.Inl(x.value0);
};
if (x instanceof PrintTest) {
return new Data_Generic_Rep.Inr(new Data_Generic_Rep.Inl(new Data_Generic_Rep.Product(x.value0, x.value1)));
};
if (x instanceof PrintPending) {
return new Data_Generic_Rep.Inr(new Data_Generic_Rep.Inr(x.value0));
};
throw new Error("Failed pattern match at Test.Spec.Reporter.Spec (line 60, column 1 - line 60, column 60): " + [ x.constructor.name ]);
}, function (x) {
if (x instanceof Data_Generic_Rep.Inl) {
return new PrintSuite(x.value0);
};
if (x instanceof Data_Generic_Rep.Inr && x.value0 instanceof Data_Generic_Rep.Inl) {
return new PrintTest(x.value0.value0.value0, x.value0.value0.value1);
};
if (x instanceof Data_Generic_Rep.Inr && x.value0 instanceof Data_Generic_Rep.Inr) {
return new PrintPending(x.value0.value0);
};
throw new Error("Failed pattern match at Test.Spec.Reporter.Spec (line 60, column 1 - line 60, column 60): " + [ x.constructor.name ]);
});
var printActionShow = new Data_Show.Show(Data_Show_Generic.genericShow(printActionGeneric)(Data_Show_Generic.genericShowSum(Data_Show_Generic.genericShowConstructor(Data_Show_Generic.genericShowArgsArgument(Data_Show.showString))(new Data_Symbol.IsSymbol(function () {
return "PrintSuite";
})))(Data_Show_Generic.genericShowSum(Data_Show_Generic.genericShowConstructor(Data_Show_Generic.genericShowArgsProduct(Data_Show_Generic.genericShowArgsArgument(Data_Show.showString))(Data_Show_Generic.genericShowArgsArgument(Test_Spec_Result.showResult)))(new Data_Symbol.IsSymbol(function () {
return "PrintTest";
})))(Data_Show_Generic.genericShowConstructor(Data_Show_Generic.genericShowArgsArgument(Data_Show.showString))(new Data_Symbol.IsSymbol(function () {
return "PrintPending";
}))))));
var print = function (dictMonadState) {
return function (dictMonadWriter) {
return function (path) {
var indent = function ($67) {
return Test_Spec_Style.indent(Data_Array.length($67));
};
return function (v) {
if (v instanceof PrintSuite) {
return Test_Spec_Console.tellLn(dictMonadWriter)(indent(path) + v.value0);
};
if (v instanceof PrintTest && v.value1 instanceof Test_Spec_Result.Success) {
var speedDetails = (function () {
if (v.value1.value0 instanceof Test_Spec_Speed.Fast) {
return "";
};
return Test_Spec_Style.styled(Test_Spec_Speed.toStyle(v.value1.value0))(" (" + (Data_Show.show(Data_Show.showInt)(Data_Int.round(v.value1.value1)) + "ms)"));
})();
return Test_Spec_Console.tellLn(dictMonadWriter)(indent(path) + (Test_Spec_Style.styled(Test_Spec_Style.green)("\u2713\ufe0e ") + (Test_Spec_Style.styled(Test_Spec_Style.dim)(v.value0) + speedDetails)));
};
if (v instanceof PrintTest && v.value1 instanceof Test_Spec_Result.Failure) {
return Control_Bind.bind((dictMonadState.Monad0()).Bind1())(Control_Monad_State_Class.modify(dictMonadState)(function (s) {
var $37 = {};
for (var $38 in s) {
if ({}.hasOwnProperty.call(s, $38)) {
$37[$38] = s[$38];
};
};
$37.numFailures = s.numFailures + 1 | 0;
return $37;
}))(function (v1) {
return Test_Spec_Console.tellLn(dictMonadWriter)(indent(path) + Test_Spec_Style.styled(Test_Spec_Style.red)(Data_Show.show(Data_Show.showInt)(v1.numFailures) + (") " + v.value0)));
});
};
if (v instanceof PrintPending) {
return Test_Spec_Console.tellLn(dictMonadWriter)(indent(path) + Test_Spec_Style.styled(Test_Spec_Style.cyan)("- " + v.value0));
};
throw new Error("Failed pattern match at Test.Spec.Reporter.Spec (line 70, column 14 - line 83, column 65): " + [ v.constructor.name ]);
};
};
};
};
var initialState = {
runningItems: Data_Map_Internal.empty,
numFailures: 0
};
var specReporter = Test_Spec_Reporter_Base.defaultReporter(initialState)(Test_Spec_Reporter_Base.defaultUpdate({
getRunningItems: function (v) {
return v.runningItems;
},
putRunningItems: Data_Function.flip(function (v) {
return function (v1) {
return {
runningItems: v1,
numFailures: v.numFailures
};
};
}),
printFinishedItem: function (path) {
return function (v) {
if (v instanceof Test_Spec_Reporter_Base.RunningTest && v.value1 instanceof Data_Maybe.Just) {
return print(Control_Monad_State_Trans.monadStateStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Control_Monad_State_Trans.monadWriterStateT(Control_Monad_Writer_Trans.monadWriterWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(path)(new PrintTest(v.value0, v.value1.value0));
};
if (v instanceof Test_Spec_Reporter_Base.RunningPending) {
return print(Control_Monad_State_Trans.monadStateStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Control_Monad_State_Trans.monadWriterStateT(Control_Monad_Writer_Trans.monadWriterWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(path)(new PrintPending(v.value0));
};
if (v instanceof Test_Spec_Reporter_Base.RunningSuite && v.value1) {
return print(Control_Monad_State_Trans.monadStateStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Control_Monad_State_Trans.monadWriterStateT(Control_Monad_Writer_Trans.monadWriterWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(path)(new PrintSuite(v.value0));
};
return Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Data_Unit.unit);
};
},
update: function (v) {
if (v instanceof Test_Spec_Runner_Event.Suite && v.value0 instanceof Test_Spec_Runner_Event.Sequential) {
return print(Control_Monad_State_Trans.monadStateStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Control_Monad_State_Trans.monadWriterStateT(Control_Monad_Writer_Trans.monadWriterWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(v.value1)(new PrintSuite(v.value2));
};
if (v instanceof Test_Spec_Runner_Event.TestEnd) {
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Control_Monad_State_Class.get(Control_Monad_State_Trans.monadStateStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity))))(function (v1) {
return Control_Applicative.when(Control_Monad_State_Trans.applicativeStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Data_Maybe.isNothing(Data_Map_Internal.lookup(Data_Ord.ordArray(Test_Spec_Tree.pathItemOrd))(v.value0)(v1.runningItems)))(print(Control_Monad_State_Trans.monadStateStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Control_Monad_State_Trans.monadWriterStateT(Control_Monad_Writer_Trans.monadWriterWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(v.value0)(new PrintTest(v.value1, v.value2)));
});
};
if (v instanceof Test_Spec_Runner_Event.Pending) {
return Control_Bind.bind(Control_Monad_State_Trans.bindStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Control_Monad_State_Class.get(Control_Monad_State_Trans.monadStateStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity))))(function (v1) {
return Control_Applicative.when(Control_Monad_State_Trans.applicativeStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Data_Map_Internal.isEmpty(v1.runningItems))(print(Control_Monad_State_Trans.monadStateStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Control_Monad_State_Trans.monadWriterStateT(Control_Monad_Writer_Trans.monadWriterWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(v.value0)(new PrintPending(v.value1)));
});
};
if (v instanceof Test_Spec_Runner_Event.End) {
return Test_Spec_Reporter_Base.defaultSummary(Control_Monad_State_Trans.monadWriterStateT(Control_Monad_Writer_Trans.monadWriterWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(v.value0);
};
return Control_Applicative.pure(Control_Monad_State_Trans.applicativeStateT(Control_Monad_Writer_Trans.monadWriterT(Data_Monoid.monoidString)(Data_Identity.monadIdentity)))(Data_Unit.unit);
}
}));
module.exports = {
specReporter: specReporter
};