Last active
December 14, 2015 10:19
-
-
Save slyrus/5071736 to your computer and use it in GitHub Desktop.
this one fails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Ok, here's a simple standalone test case that fails. | |
;;; | |
;;; NB: make sure you #-abcl the evaluate define-compiler-macro form in xpath/api.lisp | |
;;; in order to load xpath properly | |
;;; | |
;;; Then C-c C-k this form from slime and boom... | |
(defpackage :xpath-bug | |
(:use :cl)) | |
(in-package :xpath-bug) | |
(defun my-evaluate-fn (xpath context &optional unordered-p) | |
(xpath::evaluate-compiled | |
(if (functionp xpath) | |
xpath | |
(xpath::compile-xpath xpath (xpath::make-dynamic-environment xpath::*dynamic-namespaces*))) | |
context | |
unordered-p)) | |
(eval-when (:compile-toplevel :load-toplevel :execute) | |
(defun my-evaluate (xpath context &optional unordered-p) | |
(xpath::evaluate-compiled | |
(if (functionp xpath) | |
xpath | |
(xpath::compile-xpath xpath (xpath::make-dynamic-environment xpath::*dynamic-namespaces*))) | |
context | |
unordered-p)) | |
(define-compiler-macro my-evaluate (xpath context &optional unordered-p) | |
(xpath::once-only (xpath) | |
`(xpath::evaluate-compiled | |
(if (functionp ,xpath) | |
,xpath | |
(xpath::with-cache ((,xpath :test equal) | |
(xpath::*dynamic-namespaces* :test xpath::namespaces-match-p) | |
(xpath::*profiling-enabled-p* :test eql)) | |
(xpath::compile-xpath ,xpath | |
(xpath::make-dynamic-environment | |
xpath::*dynamic-namespaces*)))) | |
,context | |
,unordered-p)))) | |
(xpath:with-namespaces (("" "")) | |
(my-evaluate-fn "count(html/following::text())" | |
(cxml:parse-rod "<html></html>" | |
(cxml-dom:make-dom-builder)))) | |
(xpath:with-namespaces (("" "")) | |
(my-evaluate "count(html/following::text())" | |
(cxml:parse-rod "<html></html>" | |
(cxml-dom:make-dom-builder)))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment