#!/bin/sh

./emacs -Q -batch -eval '
  (progn
    (defvar foo-present nil)
    (defun bad-eq (a b)
      (eq a b))
    (defun bad-hash (a)
      (if (and foo-present (eq a 2))
          (gethash '\''foo h)
	(sxhash-eq '\''foo)))
    (define-hash-table-test '\''bad-test '\''bad-eq '\''bad-hash)
    (setq h (make-hash-table :test '\''bad-test))
    (puthash 0 (sxhash-eq 0) h)
    (puthash '\''foo (sxhash-eq '\''foo) h)
    (remhash 0 h)
    (setq foo-present t)
    (puthash 2 (sxhash-eq '\''foo) h)
    (message "%s %s" h (gethash 2 h))
    (dump-emacs-portable "test.pdmp"))
'
./emacs --dump-file test.pdmp -Q -batch -eval '(message "%s %s" h (gethash 2 h))'
