]> git.eshelyaron.com Git - emacs.git/commitdiff
Binsert support
authorAndrea Corallo <andrea_corallo@yahoo.it>
Sun, 16 Jun 2019 13:32:29 +0000 (15:32 +0200)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:33:42 +0000 (11:33 +0100)
src/comp.c
test/src/comp-tests.el

index f19fc84479bc23da5e2511835a4af7147851e2a2..134d1baabcdf91726df34bda04c309e36320d423 100644 (file)
@@ -1945,7 +1945,8 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
          break;
 
        case BinsertN:
-         error ("BinsertN not supported");
+         op = FETCH;
+         EMIT_SCRATCH_CALL_N ("Finsert", op);
          break;
 
        case Bstack_set:
index f1acc42b8cafdd14e2086246dbe377a80198e47c..931b9e060942194a4ef43fa4ca57e88c454b4670 100644 (file)
     (1+ (let ((a 1)
             (_b)
             (_c))
-        a)))
+          a)))
+  (defun comp-tests-insertn-f (a b c d)
+    ;; Binsert
+    (insert a b c d))
 
   (byte-compile #'comp-tests-discardn-f)
   (native-compile #'comp-tests-discardn-f)
+  (byte-compile #'comp-tests-insertn-f)
+  (native-compile #'comp-tests-insertn-f)
 
-  (should (= (comp-tests-discardn-f 10) 2)))
+  (should (= (comp-tests-discardn-f 10) 2))
+
+  (should (string= (with-temp-buffer
+                      (comp-tests-insertn-f "a" "b" "c" "d")
+                      (buffer-string))
+                   "abcd")))
 
 (ert-deftest comp-tests-gc ()
   "Try to do some longer computation to let the gc kick in."