Select the types of activity you want to include in your feed.
PRX-30: Add v2 variants of psr.pattern,psr.struct,psr.misc
Also: - properly abort preflight parsing by injecting an EOF token - also consider dependencies when resolving modules - remove a debug println in prop.pxs - add app.config
···11+22+name psr::pattern::test/2.0;
33+references {
44+ psr::test,
55+ psr::pattern
66+};
77+88+namespace import
99+ sys.*,
1010+ sys.seq.*,
1111+ psr.test.assertions.*,
1212+ psr.pattern.*,
1313+ sys.rt(boxed)
1414+;
1515+1616+function test_con[test]
1717+{
1818+ var a = 11;
1919+ var b = 13;
2020+2121+ var x = kvp(a,b);
2222+ assert(x is Prexonite::Types::PValueKeyValuePair,"$(boxed(x)) is not a PValueKeyValuePair");
2323+ assert_eq(x.Key,a,"Key of $(boxed(x)) doesn't match");
2424+ assert_eq(x.Value,b,"Value of $(boxed(x)) doesn't match");
2525+2626+ //nested
2727+ var c = 17;
2828+ var d = 19;
2929+ var x = kvp(kvp(a,b),kvp(c,d));
3030+ assert(x is Prexonite::Types::PValueKeyValuePair,"$(boxed(x)) is not a PValueKeyValuePair (nested)");
3131+ var xa = x.Key;
3232+ assert(xa is Prexonite::Types::PValueKeyValuePair,"$(boxed(xa)) should be PValueKeyValuePair (key of nested)");
3333+ assert_eq(xa.Key,a,"Key of $(boxed(xa)) doesn't match");
3434+ assert_eq(xa.Value,b,"Value of $(boxed(xa)) doesn't match");
3535+ var xb = x.Value;
3636+ assert(xb is Prexonite::Types::PValueKeyValuePair,"$(boxed(xb)) should be PValueKeyValuePair (key of nested)");
3737+ assert_eq(xb.Key,c,"Key of $(boxed(xb)) doesn't match");
3838+ assert_eq(xb.Value,d,"Value of $(boxed(xb)) doesn't match");
3939+}
4040+4141+function test_dcon[test]
4242+{
4343+ var a = 11;
4444+ var b = 13;
4545+4646+ var p = a:b;
4747+ kvp(var x,var y) = p;
4848+ assert_eq(x,a,"Key doesn't match");
4949+ assert_eq(y,b,"Value doesn't match");
5050+5151+ var c = 17;
5252+ var s = new Structure;
5353+ var mem_called = false;
5454+ s.\\("mem") = (self,z) => {
5555+ assert_eq(mem_called,false,"s.mem already called");
5656+ mem_called = true;
5757+ assert_eq(z,c,"mem arg doesn't match");
5858+ };
5959+6060+ var q = p:c;
6161+6262+ var x = y = null;
6363+ kvp(kvp(var x, var y),s.mem) = q;
6464+6565+ assert_eq(x,a,"Key doesn't match #2");
6666+ assert_eq(y,b,"Value doesn't match #2");
6767+ assert(mem_called,"s.mem has not been called");
6868+6969+}
+106
PrexoniteTests/psr-tests/_2/prop.test.pxs
···11+name psr::prop::test/2.0;
22+references {
33+ psr::test,
44+ psr::prop,
55+ psr::ast,
66+ psr::$macro
77+};
88+99+namespace import
1010+ sys.*,
1111+ psr.test.assertions.*,
1212+ psr.prop.*,
1313+ psr.ast,
1414+ psr.ast.SI,
1515+ psr.$macro.ast,
1616+ sys.ct.entityref_to,
1717+ sys.rt.boxed;
1818+1919+function test_prop_simple[test]
2020+{
2121+ function p = prop;
2222+2323+ assert(p is null,"Property p should be initialized to null.");
2424+ var a = 13;
2525+ p(a);
2626+ assert_eq(p,a,"Assignment to p failed.");
2727+ p(null);
2828+ assert(p is null,"Cannot assign null");
2929+}
3030+3131+var test_prop_capset\store;
3232+3333+function test_prop_capset\impl(isset,x)
3434+{
3535+ var old = test_prop_capset\store;
3636+ test_prop_capset\store = isset.ToString + x;
3737+ return old;
3838+}
3939+4040+macro test_prop_capset
4141+{
4242+ var fc = ast.call(context.Call, entityref_to(test_prop_capset\impl));
4343+ fc.Arguments.Add(ast.const(SI.eq(context.Call,SI.set)));
4444+ fc.Arguments.AddRange(var args);
4545+ context.Block.Expression = fc;
4646+}
4747+4848+function test_prop_proxy[test]
4949+{
5050+ function p = prop(test_prop_capset);
5151+5252+ assert(p is null,"Property p should be initialized to null.");
5353+ var a = 13;
5454+ p(a);
5555+ assert_eq(p,"True13");
5656+ assert_eq(p,"False");
5757+ p(null);
5858+ assert_eq(p,"True");
5959+ assert_eq(p,"False");
6060+}
6161+6262+function test_prop_complex[test]
6363+{
6464+ var assert_flag = null;
6565+ var a = 11;
6666+ function p = prop(() =>
6767+ {
6868+ if(assert_flag is null)
6969+ {
7070+ return null;
7171+ }
7272+ else
7373+ {
7474+ assert(assert_flag,"Unexpected call to getter");
7575+ assert_flag = false;
7676+ return a;
7777+ }
7878+ },
7979+ value =>
8080+ {
8181+ assert(not assert_flag~Bool,"Unexpected call to setter with $(boxed(value))");
8282+ assert_eq(value,a,"Unexpected value");
8383+ assert_flag = true;
8484+ });
8585+8686+ assert(p is null,"Property p should be initialized to null");
8787+ p(a);
8888+ assert_eq(p,a);
8989+ a += 2;
9090+ p = a;
9191+ assert_eq(p,a);
9292+}
9393+9494+function test_prop_glob = prop;
9595+9696+function test_prop_simple_glob[test]
9797+{
9898+ declare test_prop_glob as p;
9999+100100+ assert(p is null,"Property p should be initialized to null.");
101101+ var a = 13;
102102+ p(a);
103103+ assert_eq(p,a,"Assignment to p failed.");
104104+ p(null);
105105+ assert(p is null,"Cannot assign null");
106106+}
+14-4
PrexoniteTests/psr-tests/_2/run_tests.pxs
···3030 } else {
3131 // taskMap~Dictionary<ModuleName, Task<Tuple<Application, ITarget>>>
3232 var taskMap = host.self_assembling_build_plan.LoadAsync(names, no_cancellation);
3333- System::Threading::Tasks::Task.WaitAll(taskMap.Values >> map(?~Object<"System.Threading.Tasks.Task`1[System.Tuple`2[Prexonite.Application,Prexonite.Compiler.Build.ITarget]]">) >> to_list);
3333+ var taskArray = (
3434+ taskMap.Values
3535+ >> map(?~Object<"System.Threading.Tasks.Task`1[System.Tuple`2[Prexonite.Application,Prexonite.Compiler.Build.ITarget]]">)
3636+ >> to_list
3737+ )~Object<"System.Threading.Tasks.Task[]">;
3838+ until(System::Threading::Tasks::Task.WaitAll(taskArray, 1000)) {
3939+ print(".");
4040+ }
3441 var resultMap = new Object<"System.Collections.Generic.Dictionary`2[Prexonite.Modular.ModuleName,System.Tuple`2[Prexonite.Application,Prexonite.Compiler.Build.ITarget]]">;
3542 foreach(var entry in taskMap) {
3643 resultMap[entry.Key] = entry.Value.Result;
···4855 var src = new source_file(file_path);
4956 targetDescriptionTasks[] = host.self_assembling_build_plan.AssembleAsync(src, no_cancellation);
5057 }
5151- System::Threading::Tasks::Task.WaitAll(targetDescriptionTasks~Object<"System.Threading.Tasks.Task[]">);
5858+ var targetTaskArray = targetDescriptionTasks~Object<"System.Threading.Tasks.Task[]">;
5959+ until(System::Threading::Tasks::Task.WaitAll(targetTaskArray, 1000)) {
6060+ print(".");
6161+ }
5262 timer.stop;
5363 var totalCompTime = timer.elapsed;
5454- println("done.");
6464+ println(" done.");
5565 timer.reset;
56665767 print("Compiling $(targetDescriptionTasks.Count) test modules (and their dependencies)...");
···5969 var testSuiteMap = load_from_descriptions(targetDescriptionTasks, var args >> exists(?.Contains("cil")));
6070 timer.stop;
6171 totalCompTime += timer.elapsed;
6262- println("done.");
7272+ println(" done.");
6373 timer.reset;
64746575 // Check for compile errors
···22references {
33 prx/1.0
44};
55-test\version "0.2";
6576namespace psr.test.v1
87 import prx.v1(*)
···109 // NOTE: test is not split up into impl and dependencies because it must not
1110 // have any dependencies.
1211 build does add("../../test.pxs");
1212+ test\version "2.0";
1313}
14141515namespace psr.test {} export psr.test.v1(