Back

root (clj)

(source)

function

(root loc)
zips all the way up and returns the root node, reflecting any changes.

Examples

clojure

(ns clojure.test-clojure.clojure-zip
  (:use clojure.test)
  (:require [clojure.zip :as zip]))


; zipper
;
; seq-zip
; vector-zip
; xml-zip
;
; node
; branch?
; children
; make-node
; path
; lefts
; rights
; down
; up
; root
; right
; rightmost
; left
; leftmost
;
; insert-left
; insert-right
; replace
; edit
; insert-child
; append-child
; next
; prev
; end?
; remove
marick/Midje
(ns midje.parsing.1-to-explicit-form.t-facts
  (:require [midje.parsing.1-to-explicit-form.facts :as facts :refer :all]
            [midje.sweet :refer :all]
            [midje.test-util :refer :all]
            [midje.parsing.2-to-lexical-maps.expects :refer [expect]]
            [midje.parsing.2-to-lexical-maps.fakes :refer [fake]]
            [midje.parsing.2-to-lexical-maps.data-fakes :refer [data-fake]]
            [pointer.core :refer [line-number-known]]
            [clojure.zip :as zip]
            [midje.config :as config]))


(fact "one can add a line number to an arrow sequence"
  (let [original `( (f n) => 2  )
        expected `( (f n) => 2 :position (line-number-known 10))
        z            (zip/seq-zip original)
        original-loc (-> z zip/down zip/right)
        new-loc      (#'facts/at-arrow__add-line-number-to-end__no-movement
                       10 original-loc)]
    (name (zip/node new-loc)) => "=>"
    (zip/root new-loc) => expected))