[m-rev.] diff: subst implementation-defined literals in shorthand goals

Peter Wang novalazy at gmail.com
Fri Feb 5 17:16:00 AEDT 2010


On 2010-02-05, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> 
> Is there already a regression test #127 in the test suite?
> (If not, then please add one).

Done.

Branches: main

tests/hard_coded/impl_def_literal.exp:
tests/hard_coded/impl_def_literal.m:
        Test implementation-defined literals in try goals and atomic goals
        (bug #127).

diff --git a/tests/hard_coded/impl_def_literal.exp b/tests/hard_coded/impl_def_literal.exp
index f576139..a26e66b 100644
--- a/tests/hard_coded/impl_def_literal.exp
+++ b/tests/hard_coded/impl_def_literal.exp
@@ -4,6 +4,8 @@ impl_def_literal
 predicate `impl_def_literal.main'/2
 function `impl_def_literal.a_function'/0
 predicate `impl_def_literal.a_lambda'/1
+predicate `impl_def_literal.a_try_goal'/1
+predicate `impl_def_literal.an_atomic_goal'/3
 fun_with_lines: unequal
 fun_with_lines_2: equal
 have $grade
diff --git a/tests/hard_coded/impl_def_literal.m b/tests/hard_coded/impl_def_literal.m
index a798875..291b705 100644
--- a/tests/hard_coded/impl_def_literal.m
+++ b/tests/hard_coded/impl_def_literal.m
@@ -5,7 +5,7 @@
 
 :- import_module io.
 
-:- pred main(io::di, io::uo) is det.
+:- pred main(io::di, io::uo) is cc_multi.
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -29,6 +29,12 @@ main(!IO) :-
     a_lambda(FromLambda),
     io.write_string(FromLambda, !IO),
     io.nl(!IO),
+    a_try_goal(FromTryGoal),
+    io.write_string(FromTryGoal, !IO),
+    io.nl(!IO),
+    an_atomic_goal(FromAtomicGoal, !IO),
+    io.write_string(FromAtomicGoal, !IO),
+    io.nl(!IO),
 
     fun_with_lines(!IO),
     fun_with_lines_2(!IO),
@@ -66,6 +72,22 @@ a_lambda(String) :-
     Pred = (pred($pred::out) is det),
     Pred(String).
 
+:- pred a_try_goal(string::out) is cc_multi.
+
+a_try_goal(String) :-
+    (try []
+        String = $pred
+    then
+        true
+    ).
+
+:- pred an_atomic_goal(string::out, io::di, io::uo) is det.
+
+an_atomic_goal(String, !IO) :-
+    atomic [outer(!IO), inner(!STM)] (
+        String = $pred
+    ).
+
 :- pred fun_with_lines(io::di, io::uo) is det.
 
 fun_with_lines(!IO) :-

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list