|
1563 | 1563 | inst (str "2010-" (pad month) "-" (pad day) "T" (pad hour) ":14:15.666-00:00")]
|
1564 | 1564 | (is (= (pr-str (js/Date. inst)) (str "#inst \"" inst "\"")))))
|
1565 | 1565 | (let [uuid-str "550e8400-e29b-41d4-a716-446655440000"
|
1566 |
| - uuid (UUID. uuid-str)] |
| 1566 | + uuid (cljs.core/uuid uuid-str)] |
1567 | 1567 | (is (= (pr-str uuid) (str "#uuid \"" uuid-str "\""))))
|
1568 | 1568 | ;; pr-str PersistentQueueSeq - CLJS-800
|
1569 | 1569 | (is (= (pr-str (rest (conj cljs.core.PersistentQueue.EMPTY 1 2 3))) "(2 3)"))
|
|
1623 | 1623 |
|
1624 | 1624 | (deftest test-uuid
|
1625 | 1625 | (testing "Testing UUID"
|
1626 |
| - (is (= (UUID. "550e8400-e29b-41d4-a716-446655440000") |
1627 |
| - (UUID. "550e8400-e29b-41d4-a716-446655440000"))) |
1628 |
| - (is (not (identical? (UUID. "550e8400-e29b-41d4-a716-446655440000") |
1629 |
| - (UUID. "550e8400-e29b-41d4-a716-446655440000")))) |
1630 |
| - (is (= 42 (get {(UUID. "550e8400-e29b-41d4-a716-446655440000") 42} |
1631 |
| - (UUID. "550e8400-e29b-41d4-a716-446655440000") |
| 1626 | + (is (= (cljs.core/uuid "550e8400-e29b-41d4-a716-446655440000") |
| 1627 | + (cljs.core/uuid "550e8400-e29b-41d4-a716-446655440000"))) |
| 1628 | + (is (not (identical? (cljs.core/uuid "550e8400-e29b-41d4-a716-446655440000") |
| 1629 | + (cljs.core/uuid "550e8400-e29b-41d4-a716-446655440000")))) |
| 1630 | + (is (= 42 (get {(cljs.core/uuid "550e8400-e29b-41d4-a716-446655440000") 42} |
| 1631 | + (cljs.core/uuid "550e8400-e29b-41d4-a716-446655440000") |
1632 | 1632 | :not-at-all-found)))
|
1633 | 1633 | (is (= :not-at-all-found
|
1634 |
| - (get {(UUID. "550e8400-e29b-41d4-a716-446655440000") 42} |
1635 |
| - (UUID. "666e8400-e29b-41d4-a716-446655440000") |
| 1634 | + (get {(cljs.core/uuid "550e8400-e29b-41d4-a716-446655440000") 42} |
| 1635 | + (cljs.core/uuid "666e8400-e29b-41d4-a716-446655440000") |
1636 | 1636 | :not-at-all-found)))
|
1637 |
| - (is (= -1 (compare (UUID. "550e8400-e29b-41d4-a716-446655440000") |
1638 |
| - (UUID. "666e8400-e29b-41d4-a716-446655440000")))) |
1639 |
| - (is (= 1 (compare (UUID. "550e8400-e29b-41d4-a716-446655440000") |
1640 |
| - (UUID. "550e8400-a29b-41d4-a716-446655440000")))) |
1641 |
| - (is (= 0 (compare (UUID. "550e8400-e29b-41d4-a716-446655440000") |
1642 |
| - (UUID. "550e8400-e29b-41d4-a716-446655440000")))) |
1643 |
| - )) |
| 1637 | + (is (= -1 (compare (cljs.core/uuid "550e8400-e29b-41d4-a716-446655440000") |
| 1638 | + (cljs.core/uuid "666e8400-e29b-41d4-a716-446655440000")))) |
| 1639 | + (is (= 1 (compare (cljs.core/uuid "550e8400-e29b-41d4-a716-446655440000") |
| 1640 | + (cljs.core/uuid "550e8400-a29b-41d4-a716-446655440000")))) |
| 1641 | + (is (= 0 (compare (cljs.core/uuid "550e8400-e29b-41d4-a716-446655440000") |
| 1642 | + (cljs.core/uuid "550e8400-e29b-41d4-a716-446655440000"))))) |
| 1643 | + (testing "UUID hashing" |
| 1644 | + (let [id "550e8400-e29b-41d4-a716-446655440000" |
| 1645 | + uuid (cljs.core/uuid id) |
| 1646 | + expected (goog.string/hashCode id)] |
| 1647 | + (is (= expected (hash uuid))) |
| 1648 | + ;; checking hash cache |
| 1649 | + (is (= expected (.-__hash uuid))) |
| 1650 | + (is (= expected (hash uuid)))))) |
1644 | 1651 |
|
1645 | 1652 | (deftest test-comparable
|
1646 | 1653 | (testing "Testing IComparable"
|
|
0 commit comments