Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

info: don't use a fallback for ns-qualified symbols #134

Merged
merged 6 commits into from
Oct 2, 2021
Merged

Conversation

vemv
Copy link
Member

@vemv vemv commented Oct 2, 2021

  • info: don't use a fallback for ns-qualified symbols
    • Closes Regression in eldoc  #133
    • ℹ️ cider-nrepl will still need to get a couple tests adapted (and probably a couple more added)
  • Add make install command
    • Also includes our usual refinements (-user etc).
  • Unflake a test

Comment on lines -80 to -81
;; it's an unqualified sym maybe referred
(some-> ns (m/resolve-var unqualified-sym) (m/var-meta))
Copy link
Member Author

@vemv vemv Oct 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed these two lines, I don't think they make sense. If one is explicitly querying :sym foo/+ (i.e. fully-qualified), then trying to resolve + without foo is not accurate.

The comment says maybe referred. But (some-> ns (m/resolve-var sym) (m/var-meta))a few lines above already handles refers, that's part of what resolve-var/ns-resolve do

@@ -368,7 +369,7 @@
(map #(select-keys % [:ns :name :arglists :macro :file]))))))

(testing "- :clj"
(is (= (take 2 (repeat expected))
(is (= [{}, expected]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this expectation, orchard.test-ns/my-add does not exist so the right result for it is {}

@vemv vemv changed the title info: don't fall back to clojure.core for fully-qualified symbols info: don't use a fallback for ns-qualified symbols Oct 2, 2021
@vemv vemv changed the title info: don't use a fallback for ns-qualified symbols info: don't use a fallback for ns-qualified symbols Oct 2, 2021
(select-keys (info/info* {:ns 'gibberish :sym 'merge})
[:added :ns :name :file])))))
(let [current-ns (-> ::_ namespace symbol)]
(are [input expected] (= expected
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like are as I think it reduces the readability of tests. For me it's better to have more testing blocks, as they make it easier to follow what a group of assertions tests exactly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we can agree to disagree? I didn't use an are of the crazy flavor here. It's a simple mapping of inputs->outputs.

Normally to reach this level of exhaustiveness with manually coded tests, one would have to take 1 to 2 'screenfuls' worth of code. That's generally not too readable - it's so wordy that it's hard to compare the test cases between them.

Normally people give up before even attempting this level of exhaustiveness, so are can invite us to do the right thing (focus on the data, compare the tests cases between them, cheaply add more cases if missing)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can live with this, I simply don't like it. Too many years of writing RSpecs I guess. :-) There's also the practical problem that CIDER's test runner doesn't work well with are, but that's not a big deal.

@@ -8,6 +8,8 @@

(deftest project-resources-test
(testing "get the correct resources for the orchard project"
(let [resources (resource/project-resources)]
(let [resources (->> (resource/project-resources)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was wrong with this test before? There were more resources returned or something?

Copy link
Member Author

@vemv vemv Oct 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were more resources returned or something?

Yes especially in local envs where there can be more resources for arbitrary reasons.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

@vemv
Copy link
Member Author

vemv commented Oct 2, 2021

0.7.3 released with these changes and consumed in cider-nrepl clojure-emacs/cider-nrepl#715

@vemv vemv merged commit fa5bbb6 into master Oct 2, 2021
@vemv vemv deleted the 133--eldoc branch October 2, 2021 10:19
@plexus
Copy link
Contributor

plexus commented Oct 4, 2021

Thanks for picking this up so quickly!

@vemv
Copy link
Member Author

vemv commented Oct 4, 2021

🍻 Turned out that 7d7f752 wasn't wrong per se but it helped surface various edge cases (covered with tests here and downstream)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in eldoc
3 participants