sharplispers / clx

a fork of crhodes' fork of danb's fork of the CLX library, an X11 client for Common Lisp
Other
116 stars 46 forks source link

GET-DEFAULT-DISPLAY: Trailing #\: is part of the decnet hostname #94

Closed PuercoPop closed 6 years ago

PuercoPop commented 6 years ago

Closes #90

Apropos,

I have a port of XCB's test suite, but I using Fiasco's API in an 'unorthodox' way so I'm not including it in this PR.

(deftest check-parse-display (display-string
                            expected-host
                            expected-display-number
                            expected-screen
                            expected-protocol)
  (multiple-value-bind
        (host display-number screen protocol)
      (parse-display display-string)
    (is (string= host expected-host))
    (is (= display-number expected-display-number))
    (is (= screen expected-screen))
    (is (eq protocol expected-protocol))))

(check-parse-display ":0"   "" 0 0 :local)
(check-parse-display ":1"   "" 1 0 :local)
(check-parse-display ":0.1" "" 0 1 :local)

;; Check hostnames/ip
(check-parse-display "x.org:0"      "x.org"      0 0 :internet)
(check-parse-display "expo:0"       "expo"       0 0 :internet)
(check-parse-display "bigmachine:1" "bigmachine" 1 0 :internet)
(check-parse-display "hydra:0.1"    "hydra"      0 1 :internet)

;; Check ipv4
(check-parse-display
 "198.112.45.11:0"    "198.112.45.11" 0 0 :internet)
(check-parse-display
 "198.112.45.11:0.1"  "198.112.45.11" 0 1 :internet)

;; Check decnet

(check-parse-display "myws::0"   "myws:"  0 0 :decnet)
(check-parse-display "big::1"    "big:"   1 0 :decnet)
(check-parse-display "hydra::0.1" "hydra:" 0 1 :decnet)
dkochmanski commented 6 years ago

Thanks!

I would make it a separate variable (i.e (effect-colon-i (if decnet-colon-p (1+ ..) ..))), but this is also fine to me. Please add the same fix to dep-openmcl, dep-allegro and dep-lispworks. These files should be merged eventually into dependent, but right now they are not.

If/when you fix the suite to match "traditional" fiasco, please make the PR as well.

PuercoPop commented 6 years ago

Updated dep-*, should have grepped just in case before submitted but I accustomed to relying on the implementation xref's capabilities.

dkochmanski commented 6 years ago

lgtm, thanks!