我注意到重要成员AmazonS3Client是虚拟的,所以Mock<AmazonS3Client>应该很容易.但
new Mock<AmazonS3Client>()
Run Code Online (Sandbox Code Playgroud)
使用Moq,给我一个错误,说没有效果RegionEndpoint.
显然需要更多一点.
新手Clojure和leiningen问题:
鉴于我的项目中的代码片段,这可以从lein repl开始:
==> (-main "something")
Run Code Online (Sandbox Code Playgroud)
产生预期的"命令:某些东西......正在运行...已完成",但在命令行中无效:
me pallet1]lein run "something"
Run Code Online (Sandbox Code Playgroud)
生成"命令:某事......错误:未解析为命令"
为什么?/ 我如何解决它?
重现:
lein new eg
Run Code Online (Sandbox Code Playgroud)
然后编辑生成的项目文件,添加:main eg.core以定义main函数,并编辑生成的src/eg/core.clj文件,并将其粘贴到:
core.clj
(ns eg.core)
(defn something [] (println "Something!"))
(defn run-command-if-any [^String commandname]
(printf "Command: %s ..." commandname)
(if-let [cmd (ns-resolve *ns* (symbol commandname))]
(
(println "running ...") (cmd) (println "done.")
)
(println "error: not resolved as a command.")
))
(defn -main [ commandname ] (run-command-if-any commandname))
Run Code Online (Sandbox Code Playgroud)
然后
lein repl
eg.core=> (-main "something")
Run Code Online (Sandbox Code Playgroud)
工作(即打印"Something!"),但lein运行的东西没有(即打印"错误:未解决"消息)
我正在尝试"获取"clojure宏并are根据现有are宏编写宏的调整版本.我想要的调整是签名[argv expr args]而不是[argv expr & args]
我尝试过
(defmacro are2 [argv expr args] `(clojure.test/are ~arg ~expr ~@args))
Run Code Online (Sandbox Code Playgroud)
哪种作品,除了它需要一个不带引号的列表:
(are2 [input] (= 0 input) (1 2 3))
Run Code Online (Sandbox Code Playgroud)
在哪里,我宁愿期待一个引用列表:
(are2 [input] (= 0 input) '(1 2 3))
Run Code Online (Sandbox Code Playgroud)
但结果是:
Unable to resolve symbol: quote in this context.
Run Code Online (Sandbox Code Playgroud)
如果我试试
(are2 [input] (= 0 input) (list 1 2 3))
Run Code Online (Sandbox Code Playgroud)
相反,然后list它本身作为测试用例处理.
什么我不明白/如何通过我的宏中的引用
我试图通过代理检查网站.
我尝试了以下方法:
$mycredentials = Get-Credential
Invoke-WebRequest -Uri heise.de -Proxy proxySrv -ProxyCredential $mycredentials
Run Code Online (Sandbox Code Playgroud)
Invoke-WebRequest:Dieser Vorgangwirdfüreinenrelativen URInichtunterstützt.在Zeile:1 Zeichen:1 + Invoke-WebRequest -Uri heise.de -Proxy proxySrv -Prox ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +类别信息:未指定:( :) [Invoke-WebRequest],InvalidOperationException + FullyQualifiedErrorId:System.InvalidOperationException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
错误翻译成英文:
Invoke-WebRequest:相对URI不支持此操作.在行:1个字符:1 + Invoke-WebRequest -Uri heise.de -Proxy proxySrv -Prox ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +类别信息:未指定:( :) [Invoke-WebRequest],InvalidOperationException + FullyQualifiedErrorId:System.InvalidOperationException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
如果我在没有代理设置的情况下尝试命令,则会从代理中收到错误.
你能帮忙搞清楚为什么吗?
clojure ×2
.net ×1
amazon-s3 ×1
c# ×1
leiningen ×1
moq ×1
powershell ×1
proxy ×1
unit-testing ×1