]> Repositorios git - scryer-prolog.git/commitdiff
correct print_var_eq bad ending check
authorMark Thom <[email protected]>
Mon, 3 Sep 2018 21:14:02 +0000 (15:14 -0600)
committerMark Thom <[email protected]>
Mon, 3 Sep 2018 21:14:02 +0000 (15:14 -0600)
src/prolog/machine/machine_state_impl.rs
src/tests.rs

index 874739340d14545c4536aff43080f1dd2b0807ef..111c44950169f3505f9c20eb9a60d69d19f302b6 100644 (file)
@@ -131,7 +131,9 @@ impl MachineState {
         let printer    = HCPrinter::from_heap_locs(&self, fmt, output, var_dir);
         let mut output = printer.print(addr);
 
-        if output.ends_with(var.as_str()) {
+        let bad_ending = format!("= {}", &var);
+        
+        if output.ends_with(&bad_ending) {
             output.truncate(orig_len);
         }
 
index 5adb8d3787e1ef0cd92e97dbb341b109f208ed1a..5f162562e55d111fd589411700c4cecaf5df7a82 100644 (file)
@@ -1928,4 +1928,10 @@ fn test_queries_on_string_lists()
     assert_prolog_success!(&mut wam, "?- partial_string(\"abc\", X), matcher(X, Y), Y = [d, e, f | G],
                                          is_partial_string(Y), is_partial_string(G), G = \"ghi\".",
                            [["X = [a, b, c, d, e, f, g, h, i]", "Y = [d, e, f, g, h, i]", "G = [g, h, i]"]]);
+    assert_prolog_success!(&mut wam, "?- partial_string(\"abc\", X), partial_string(\"ababc\", Y), Y = [a,b|Z],
+                                         X =@= Z.",
+                           [["X = [a, b, c | _]", "Y = [a, b, a, b, c | _]", "Z = [a, b, c | _]"]]);
+    assert_prolog_failure!(&mut wam, "?- partial_string(\"abc\", X), partial_string(\"ababc\", Y), Y = [a,b|Z],
+                                         X == Z.");
+
 }