File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -224,6 +224,7 @@ internals.safe_char_downcase = function(x) {
224224} ;
225225
226226internals . xstring = function ( x ) {
227+ if ( typeof x === "number" ) return x . toString ( ) ;
227228 const hasFillPointer = typeof x . fillpointer === 'number'
228229 const activechars = hasFillPointer ? x . slice ( 0 , x . fillpointer ) : x
229230 return activechars . join ( '' ) ;
Original file line number Diff line number Diff line change 5858 (test (js-object-p obj))
5959 (test (js-object-signature obj)))
6060
61+ ; ;; test in can handle numbers
62+
63+ (let ((obj (make-new #j:Object)))
64+ (test (js-object-p obj))
65+ (test (oset 456 obj 123 ))
66+ (test (equal 456 (oget obj 123 ))))
67+
6168; ;; EOF
Original file line number Diff line number Diff line change 133133 (let ((h (temp-hash-table :fill t )))
134134 (remhash ' one h)
135135 h))))
136+
137+ ; ;; Test numbers as keys
138+ (let ((ht (make-hash-table )))
139+ (test (eq nil (gethash 123 ht)))
140+ (test (eq ' foo (setf (gethash 123 ht) ' foo)))
141+ (test (eq ' foo (gethash 123 ht))))
142+
143+ ; ;; Test numbers are different than strings
144+ (let ((ht (make-hash-table :test #' equal )))
145+ (test (equal ' foo (setf (gethash 123 ht) ' foo)))
146+ (test (equal ' bar (setf (gethash " 123" ht) ' bar)))
147+ (test (equal ' foo (gethash 123 ht)))
148+ (test (equal ' bar (gethash " 123" ht)))
149+ (test (eq 2 (length (hash-table-keys ht)))))
150+
136151; ;; EOF
You can’t perform that action at this time.
0 commit comments