mirror of
https://github.com/not-kennethreitz/convore.json.git
synced 2026-06-05 23:20:19 +00:00
1 line
35 KiB
JSON
1 line
35 KiB
JSON
[{"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307292793.4099381, "message": "Each test has a specification for what it's looking for, either in the result value, or error, or stdout, or stderr, or some combination of those. If a test doesn't specify something, it's ignored. For example:", "group_id": 9739, "id": 1294156}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307292617.5798061, "message": "Here's my thinking on what to do about to do about test expressions evaluated for their side effect or for what they print, when we don't care about the value.", "group_id": 9739, "id": 1294140}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307292807.6638811, "message": "> (writec #\\A)\nout: A\n\n> (err \"foo\")\nerr: foo\n\n> (just-for-side-effect)\n\n> (pr \"abc\")\nout: abc\n\"abc\"\n", "group_id": 9739, "id": 1294159}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307292992.894145, "message": "I just checked in a \"capture.arc\" which can capture the return value, error, stdout, and stderr of running a function:", "group_id": 9739, "id": 1294174}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307293007.2872341, "message": "arc> (capture-val-out-errout (fn () (pr \"foo\")))\n((val \"foo\") (out \"foo\"))\n", "group_id": 9739, "id": 1294176}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307293159.7594211, "message": "My thought is that the test result specification for \"(just-for-side-effect)\" above would parse to \"()\", and the result specification for \"(pr \"abc\")\" above would parse to \"((val \"foo\") (out \"foo\"))\". Then for each result item in the test specification, the test runner would check if it's the same as the actual result as captured by capture-val-out-errout.", "group_id": 9739, "id": 1294181}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307294929.9674699, "message": "I think I like your \"error: \" better than \"err: \" though. And I'm thinking of \"prints\" for stdout...", "group_id": 9739, "id": 1294305}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307294947.7675011, "message": "> (+ 2 3)\n5\n\n> (err \"foo\")\nerror: foo\n\n> (ero 'foo)\nstderr: foo \\n\n\n> (writec #\\A)\nprints: A\n\n> (just-for-side-effect)\n\n> (pr \"abc\")\nprints: abc\n\"abc\"\n", "group_id": 9739, "id": 1294307}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307297763.3305869, "message": "It would treat \"(w/instring s \"abc\" (peekc s) (readc s))\" as the input expression not because Arc's reader reads that much, but because the next line isn't indented.", "group_id": 9739, "id": 1294536}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307297654.5556481, "message": "I'm also thinking it would be a nice feature for the expression to not be read from the input using \"read\", in case we're testing some library that has defined its own syntax parser. So perhaps in", "group_id": 9739, "id": 1294519}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307297690.642159, "message": "> (w/instring s \"abc\"\n (peekc s)\n (readc s))\n#\\a\n", "group_id": 9739, "id": 1294526}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307299988.9698901, "message": "hmm, I suppose to support testing languages with a different syntax the result value should also be a string such as produced by \"write\", since it may be in a incompatible syntax as well.", "group_id": 9739, "id": 1294732}, {"user_id": 32943, "stars": [], "topic_id": 38193, "date_created": 1307308340.5875959, "message": "Looks like Pygments detected PHP or something. O_o", "group_id": 9739, "id": 1295681}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307307541.2679231, "message": "ok, here's an initial stab at a test specification parser that does this stuff...: https://github.com/awwx/ar/blob/381cb626a12ae452e4ba5e165321787dd099b4ad/parse-test-spec.t", "group_id": 9739, "id": 1295533}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307307542.5250871, "message": "wow, weird code highlighting", "group_id": 9739, "id": 1295534}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307308558.1475141, "message": "oh, I should mention still todo is escaping characters like https://github.com/Pauan/ar/blob/old/lib/tester.arc#L54", "group_id": 9739, "id": 1295725}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307324545.51596, "message": "Also, I'll note that Racket already has a function for escaping regexp characters, but I think it just escapes *all* punctuation... mine only escapes the minimal necessary.", "group_id": 9739, "id": 1299243}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307324378.793848, "message": "(and stderr, maybe?)", "group_id": 9739, "id": 1299213}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307324875.1234231, "message": "hmm, any examples in the tests you've already written that needed that?", "group_id": 9739, "id": 1299300}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307325723.2031081, "message": "Also, keep in mind that the whole point of this is to make writing unit tests as easy as possible, while still allowing for more advanced stuff when you need it. The >>> syntax and ... syntax are both necessary and are very common, so that's why they're in there.", "group_id": 9739, "id": 1299460}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307326535.73614, "message": "del, if, quasiquote, assign, fn, and quote all test for gensyms", "group_id": 9739, "id": 1299569}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307326985.3589461, "message": "I could do that, yes. Then it would be like this:\n\n>>> (isa (foosomething) 'fn)\nt\n\nBut I think it looks a lot better to use:\n\n>>> (foosomething)\n#<procedure>", "group_id": 9739, "id": 1299645}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307325037.2683189, "message": "Also, it may be a good idea to have \"...\" evaluate to \".+\" instead, but I'm not sure if that's a good idea or not.", "group_id": 9739, "id": 1299325}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307324230.624763, "message": "Yeah, that's basically how Python does it. And you can even do this:\n\n>>> foo = \"bar\"\n>>> foo\n\"bar\"\n\nBut in Python, I think that an empty test clause is the same as testing for None. That won't work in Arc, because things like = return a value. Instead, I think the tester library should just ignore the value entirely (except possibly for errors).", "group_id": 9739, "id": 1299187}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307324618.6452391, "message": "oh, maybe I was confused. It wasn't escaping regexp characters that I cared out, but being able to specify characters such as \"\\n\".", "group_id": 9739, "id": 1299259}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307324877.895741, "message": "Also, one thing to keep in mind: we need *some* way to specify loose matching. Right now, my tester library is (supposed to be) very strict: if even a single character doesn't match, it will count as a failure.\n\nBut you can use \"...\" to specify \"loose matching\", just like in Python. This is the equivalent of the regexp \".*\" This is useful in many situations, such as when an expression evaluates to a function, or matching gensyms:\n\n>>> (uniq)\ng...", "group_id": 9739, "id": 1299301}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307326634.9198799, "message": "I mean,", "group_id": 9739, "id": 1299593}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307326023.5989771, "message": "(Actually, those seem to be the only two areas that I've actually used \"...\" so far)", "group_id": 9739, "id": 1299514}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307326393.1113019, "message": "(I'm assuming that when you say \"we don't need it\" that you plan to change it so Arc functions don't print with a gensym?)", "group_id": 9739, "id": 1299547}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307326694.9389861, "message": "Because, for instance, fn is implemented with a macro that expands into a gensym. And in the case of del, there is a difference between a hash table that has a key that is nil, and a hash table that doesn't have the key:\n\n>>> (= foo (obj a nil))\n>>> (foo 'a (uniq))\nnil\n\n>>> (foo 'b (uniq))\ng...", "group_id": 9739, "id": 1299603}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307325430.685823, "message": "Maybe start off using standard Arc and regexp functions to do loose matching as needed, and then see what kinds of patterns turn out to be common and perhaps could use their own syntax.", "group_id": 9739, "id": 1299403}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307324985.669523, "message": "Hm... let's see. In the post just above, \"...\" is treated like \".*\" but if you didn't escape the regexps, it would be treated as 3 characters, which would no doubt cause multiple tests to fail. So yes, it should definitely escape regexps. (not to mention that it would actually cause failures if you put in an output that evaluates to an invalid regexp)", "group_id": 9739, "id": 1299313}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307326139.79532, "message": "8, excluding procedures. 40 including procedures.", "group_id": 9739, "id": 1299524}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307326650.4455731, "message": "That seems more like an implementation detail than an end result.", "group_id": 9739, "id": 1299594}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307324676.2617681, "message": "Here's the Racket function, in case you're interested:\n\nhttp://docs.racket-lang.org/reference/regexp.html?q=case&q=change%20directory&q=environment#%28def._%28%28lib._racket/private/base..rkt%29._regexp-quote%29%29", "group_id": 9739, "id": 1299269}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307325457.2498569, "message": "(I'll note that my tester library already handles all this...)", "group_id": 9739, "id": 1299408}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307325910.937151, "message": "But there's nothing stopping you from using full regexp search, or other things like QuickCheck (which would be a great thing to add, by the way)", "group_id": 9739, "id": 1299492}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307326269.4854691, "message": "Can you point me to an example of a test you wrote that needed \"...\"? I glanced through https://github.com/Pauan/ar/tree/old/tests and saw a bunch of #<procedure...> s that weren't needed, but I didn't look at every file.", "group_id": 9739, "id": 1299535}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307325943.4045489, "message": "Do you have an example handy of a test that needed \"...\", aside from the \"#<procedure...>\" that wouldn't need to be tested for?", "group_id": 9739, "id": 1299495}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307325968.3040199, "message": "Gensyms and functions are the two common cases.", "group_id": 9739, "id": 1299499}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307326053.974992, "message": "Have any of the tests you've written so far needed \"...\", aside from the \"#<procedure...>\" s that we don't need?", "group_id": 9739, "id": 1299515}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307327200.9040921, "message": "Well, it's the question I always try to ask when I see multiple layers of complexity: are they actually needed or not? Sometimes the answer is \"yes\", sometimes the answer is \"no\". If the answer is \"yes\", I've learned something I didn't know before. For example, I hadn't thought about \"(isa (foosomething) 'fn) => t\" being uglier than the alternative.", "group_id": 9739, "id": 1299663}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307326819.785193, "message": "The first would seem like it would be better tested with a test that tests for what having a macro expand into a gensym would do for us. The second seems like it could be tested with some known value.", "group_id": 9739, "id": 1299625}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307327714.675483, "message": "Also, macros should print as #<mac> :D Hm... yes, it looks like there's going to be a few things we'll need to fix before we can integrate the unit test framework:", "group_id": 9739, "id": 1299730}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307328074.370347, "message": "1) we can start off with \"...\", and then take it out later if it seems like we don't need it any more\n\n2) I'd prefer to leave \"load\" as a primitive that just does load, so I'd like to see if \"use\" will be adequate, or if something more will be needed.", "group_id": 9739, "id": 1299760}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307328147.2572241, "message": "Also, I'll note that on my (old) fork, I had load-curdir as the primitive, and load was a function that used load-curdir. Why? Well, \"load-curdir\" means to \"load in the current directory\" and \"load\" meant \"load in the directory that you give me\"", "group_id": 9739, "id": 1299774}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307326624.7469089, "message": "Why?", "group_id": 9739, "id": 1299589}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307326735.6407571, "message": "(incidentally, this is a way to test whether a key exists in a hash table or not)", "group_id": 9739, "id": 1299611}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307327842.2261081, "message": "(Though, I suppose I might be able to replace uses of `load` with `use`... I haven't taken a good look at it, though, so I'm not sure)", "group_id": 9739, "id": 1299745}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307326584.3618591, "message": "The point of \"> (just-for-side-effect)\" is that we don't need to test results values that we don't care about. If there's a reason to care that someone is returning a function or a gensym, that would be an example of an example I'm looking for :)", "group_id": 9739, "id": 1299578}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307326611.1206951, "message": "Yes, all the areas where I test for gensyms, it's actually wanting to know whether it was a gensym or not.", "group_id": 9739, "id": 1299588}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307326671.7380509, "message": "I'm not saying it's wrong, I'm just wondering.", "group_id": 9739, "id": 1299599}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307327059.780817, "message": "I can tell you *really* don't want to use the \"...\" syntax. I'm not entirely against removing it, but I would suggest that Arc functions shouldn't print with gensyms, so they can be tested without needing the \"...\" syntax.", "group_id": 9739, "id": 1299653}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307326859.753283, "message": "You want to test that something evaluates to a macro? Or that it evaluates to a function?", "group_id": 9739, "id": 1299629}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307326815.475183, "message": "Also, there's areas where I actually do want to test whether the expression evaluates to a macro/function, which print out with gensyms. If you changed it so they didn't print with gensyms, that'd be great, and then we'd only need \"...\" at 8 places rather than 40.", "group_id": 9739, "id": 1299623}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307327363.1534171, "message": "Having things print like we want is probably pretty easy: arc.arc already prints mutable lists as (a b c) instead of Racket's {a b c . nil}. So if we want functions to print as #<fn> or whatever, we could do that.", "group_id": 9739, "id": 1299678}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307328704.6548369, "message": "use still needs some work... there are two parts: one is that when you (use foo), it pushes foo's directory onto the usepath, which perhaps serves a similar purpose to load changing the current directory. There's also supposed to be a way to push a directory onto the usepath yourself, such as by saying (use ~/mylib/), but that hasn't been implemented yet. I'm also wondering about grouping libraries, i.e. what if I have a foo library with individual files bar1 bar2 bar3, would I call those foo/bar1? That would be nice, but then in bar2 would I want to say (use foo/bar1) or (use bar2)? I think I'd want the former, but that would get confused with \"/\" as a directory separator. Maybe some other separator for \"package\" names.", "group_id": 9739, "id": 1299854}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307326920.7513349, "message": "If so, how about (isa x 'fn) ?", "group_id": 9739, "id": 1299634}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307327092.8291631, "message": "That, combined with changing some of the tests, would allow us to get rid of all the uses of \"...\"", "group_id": 9739, "id": 1299658}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307327439.898303, "message": "Yup! In fact, here's a quicky function that gets rid of the ugly gensyms:\n\n(defrule print (isa x 'fn)\n (disp \"#<procedure>\" port))", "group_id": 9739, "id": 1299683}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307327588.128252, "message": "Right, I haven't done anything about ac-nameit like Arc 3.1 does to name functions, but eventually we'd probably get #<fn:car>, which could be a use for \"...\" there.", "group_id": 9739, "id": 1299704}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307327629.2451379, "message": "(I'd rather just put #<fn:car> in the test, actually, no need for \"...\" So it seems the only reason for \"...\" so far is gensyms)", "group_id": 9739, "id": 1299715}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307327503.180496, "message": "Though it doesn't print the name, like in Racket:\n\n>>> racket-eq?\n#<procedure:eq?>\n\n>>> no\n#<procedure>", "group_id": 9739, "id": 1299692}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307327566.968858, "message": "Also, personally, I would prefer #<function> rather than #<procedure>, but that might just be me.", "group_id": 9739, "id": 1299700}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307327811.1237221, "message": "1) Replace all current uses of \"...\" with alternatives, and then get rid of it. This will likely entail changing how functions and (possibly) macros print.\n\n2) Change `load` so it handles subdirectories correctly.\n\n3) Fix up any other odd ends, like having `extend` and `defrule` bind orig.", "group_id": 9739, "id": 1299741}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307328191.3830581, "message": "I understand if you have a different idea, but we *do* need some way of handling subdirectories, whether it's with import, use, load, or something else.", "group_id": 9739, "id": 1299776}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307328243.779228, "message": "saying \"(defrule foo (isa x 'bar))\" seems like a common pattern, so perhaps extract a macro to do that.", "group_id": 9739, "id": 1299779}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307328266.1942821, "message": "Yeah, that'd be a good idea too. Then defcall and defprint can both use that macro.", "group_id": 9739, "id": 1299786}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307328095.9674151, "message": "Oh, and by the way, it seems the most common way of extending `print` is with `isa`, so I think we should put in a defprint, which would be just like defcall. So rather than writing this:\n\n(defrule print (isa x 'fn)\n (disp ... port))\n\nYou could write this:\n\n(defprint fn (x)\n ...)", "group_id": 9739, "id": 1299769}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307374747.267391, "message": "I was trying to think of a name for this style of representing tests... the best idea I've come up with so far is \"pictorial test\", because it looks like you're taking a picture of what running the code from the REPL looks like.", "group_id": 9739, "id": 1304896}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307423103.8032761, "message": "I think the more formal term is \"testing by example\", by the way :P \"pictorial\" seems to suggest a picture, and there are indeed test frameworks that test for pictures too (or hashes of pictures)", "group_id": 9739, "id": 1317019}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307424268.5053229, "message": "...I would also like to note that your tester library is broken. What was wrong with mine?", "group_id": 9739, "id": 1317176}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307424389.450716, "message": "Before you ask, here is (one of) the reason(s) why it's broken. I can't do this:\n\n> (foo 2)\n(\"qux\" 15 #<procedure> \"foo\")\n\nBecause it throws a syntax error. My library allows for this.", "group_id": 9739, "id": 1317184}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307425775.1231699, "message": "Also, I should warn you now. I plan to make a bunch of changes to make tests more organized and easier to create/manage. For instance, creating a \"tests/\" subdirectory, and having every file in there automatically tested. That way, you only need to write up the file and plop it into the folder and bam you're done.\n\nAlso, having the whole \"(pictorial-test (this-runtime) #<<.\" thing is fine, but most of the time it'll just be boilerplate, so let's add in a function that can read an entire file as a test. That way, you can either test a particular string (letting you embed the library into an Arc program), or test an entire file. This, once again, makes writing tests easier.\n\nI also plan to make the tester more powerful. For instance, I can add in a \"run-tests\" file (which is written in Arc, of course) that will run all the tests. You will also be able to specify individual tests that you want to run, and you can pass in \"-v\" to get more verbose output. My fork already had such a file, so it'll just be a matter of porting it over to ar.", "group_id": 9739, "id": 1317357}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307466869.1226361, "message": "Calling it an \"example test\" is a good idea.", "group_id": 9739, "id": 1324260}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307466729.3858249, "message": "Aha, having it check the textual representation of the result value is a lot less brittle. I will do that.", "group_id": 9739, "id": 1324203}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307467057.0543959, "message": "Writing tests in Arc is important because we may need to wrap a test in some specific context or setup, or want to use macros. If the \"(example-test #<<.\" syntax is awkward, we should improve the syntax.", "group_id": 9739, "id": 1324339}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307466896.191643, "message": "I wanted to be able to specify which kinds of results from a test are important, so the result value could be ignored if it didn't matter. I didn't use your re library because I didn't understand it.", "group_id": 9739, "id": 1324266}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307467104.0014219, "message": "I prefer to group tests with the code being tested. So, I might have subdirectories to organize code, but I'd put the tests in the subdirectory along with the code; not have a separate \"tests\" directory.", "group_id": 9739, "id": 1324357}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307478649.910363, "message": "@rocketnia \" I had trouble adding my tests a while back was 'cause I couldn't tell which files were for tests and which weren't\" does the foo.t convention help?", "group_id": 9739, "id": 1327519}, {"user_id": 32943, "stars": [], "topic_id": 38193, "date_created": 1307477450.3154609, "message": "Oh, I see. Part of the reason I had trouble adding my tests a while back was 'cause I couldn't tell which files were for tests and which weren't. :-p I like Pauan's convention-over-configuration idea of plunking all the tests in a single directory (and it could support Arc tests too, dispatching by file extension), but I also just generally like a certain amount of classification into subdirectories. I'm fine either way though.", "group_id": 9739, "id": 1327266}, {"user_id": 32943, "stars": [], "topic_id": 38193, "date_created": 1307485527.4563739, "message": "I'm sure it would have been harder *without* that convention, yeah, but that was something I could see right away, and yet I still felt the need to comment on my oh so horrendously crippling turmoils. :-p", "group_id": 9739, "id": 1329219}, {"user_id": 32943, "stars": [], "topic_id": 38193, "date_created": 1307485536.7861609, "message": "Seriously, my issue is that all the files are in the same listing, so I have to scan over all of them to find whatever I'm looking for. But I also get annoyed navigating through a bunch of directories trying to find the right one, so I can appreciate your repo as just having a different sweet spot than what I expect.", "group_id": 9739, "id": 1329223}, {"user_id": 32943, "stars": [], "topic_id": 38193, "date_created": 1307485591.5626371, "message": "Furthermore, I also appreciate the idea of having \"foo\" and \"foo.t\" right next to each other so you can tell at a glance whether there are entire files which don't have any tests.", "group_id": 9739, "id": 1329258}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307506026.5020859, "message": "\"I wanted to be able to specify which kinds of results from a test are important, so the result value could be ignored if it didn't matter.\"\n\nOkay, but my tester library could be easily changed to do that.", "group_id": 9739, "id": 1333248}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307506111.3560579, "message": "\"Writing tests in Arc is important because we may need to wrap a test in some specific context or setup, or want to use macros.\"\n\nMacros should work with my setup. And perhaps you misunderstood... I was not saying to *replace* the existing setup, I was saying to *add* a new way. This new way would make writing tests easier, but would still allow for `example-test` when needed.", "group_id": 9739, "id": 1333268}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307506183.3889201, "message": "\"not have a separate \"tests\" directory.\"\n\nI am sorry, but I must disagree strongly with that. The ar directory is a mess, with dozens of files serving completely different purposes all mashed together. This will make it harder to hack, and also harder to use, for users.\n\nBut it's your repository, so do as you wish. I will fork as needed, though I would prefer not to.", "group_id": 9739, "id": 1333301}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307507997.6270659, "message": "Alright... now the next roadblock for \"extend.t\"... it's printing out functions as #<procedure:g1617> AKA with gensyms. So in order to make this pass, I'll need to change it so functions print as #<fn> or similar", "group_id": 9739, "id": 1333717}, {"user_id": 32943, "stars": [], "topic_id": 38193, "date_created": 1307511055.8795271, "message": "Why not make the test pass by wrapping it in (isa ... 'fn)? I personally don't find that uglier--in fact, I find it unsettling to have a test that relies on a detail we don't really care about--but it's something simple for now that can be \"fixed\" in a separate commit.", "group_id": 9739, "id": 1334100}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307511225.2349899, "message": "Well, okay, but I've already got the #<fn> fix sitting here on my repo. It's not a particularly big change either.", "group_id": 9739, "id": 1334111}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307545279.51651, "message": "\"dozens of files serving completely different purposes all mashed together\"\n\nIdeally code serving different purposes should be able to be published separately. For example, whatever testing library ar uses shouldn't need to be in ar itself; it should be a library available somewhere anyone (including ar) can use.", "group_id": 9739, "id": 1337943}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307633846.4027219, "message": "@Pauan I was wondering how you implemented \"...\"; looking at tester.arc, it looks like you take the expected output, turn it into a regular expression, and then use the regexp to match against the actual output?", "group_id": 9739, "id": 1351187}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307646697.097811, "message": "@rocketnia \"Why not make the test pass by wrapping it in (isa ... 'fn)\" yes, for this specific example, I'd probably use:", "group_id": 9739, "id": 1352809}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307646756.5535619, "message": "> (type x)\nfn", "group_id": 9739, "id": 1352814}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1307646807.5660739, "message": "myself as a way to indicate that it's the type in particular that I'm testing for.", "group_id": 9739, "id": 1352816}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307692701.0728431, "message": "> (type x)\nfn\n\nYes, I've used that in some of my tests, like for object.arc But I don't think it's *always* the best or cleanest way. I'll note that if you care about that, you'd probably prefer something like aw's old tester library, that uses testiso.", "group_id": 9739, "id": 1358340}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1307692402.7024751, "message": "\"it looks like you take the expected output, turn it into a regular expression, and then use the regexp to match against the actual output?\"\n\nYes, that's what my tester library does.", "group_id": 9739, "id": 1358282}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1308080438.694973, "message": "hmm, the test by example approach works really well when an expression returns one value that we want to check, but we need to collect results into a list and then check the list if the expression has multiple values that we want to check. Perhaps a syntax to check values in the middle of an expression... might be useful as well in code as a way to make assertions.", "group_id": 9739, "id": 1393388}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1308082458.444536, "message": "(I'll note this is what Python does as well)", "group_id": 9739, "id": 1393695}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1308082098.294353, "message": "Do you have an example handy where you used the (pr ...) technique?", "group_id": 9739, "id": 1393647}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1308082023.7764471, "message": "Or you could use (pr ...) with my library. But yours doesn't seem to work like that.", "group_id": 9739, "id": 1393639}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1308082045.8694761, "message": "But yes, an (assert ...) form would be nice in general.", "group_id": 9739, "id": 1393642}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1308082372.6542721, "message": "oh, so you don't distinguish between a printed value and a return value? (Now saying you should, just want to understand the syntax)", "group_id": 9739, "id": 1393692}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1308082468.2728031, "message": "ah, so that's why you don't have a way to say that we don't care about a return value. That makes sense.", "group_id": 9739, "id": 1393697}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1308082205.176039, "message": "On the \"old\" branch of my fork, in the \"tests/\" subdirectory, in the \"arc\" file, line 640.", "group_id": 9739, "id": 1393660}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1308082395.6496091, "message": "That's right! It just gathers up the output and does a string compare.", "group_id": 9739, "id": 1393693}, {"user_id": 25438, "stars": [], "topic_id": 38193, "date_created": 1308082675.6929641, "message": "how would I check that something prints something, without checking its return value? (assuming I wanted to)", "group_id": 9739, "id": 1393721}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1308082707.7912199, "message": "Well, I reckon you'd use tostring:\n\n> (tostring (foo))\n\"foobar\"", "group_id": 9739, "id": 1393728}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1308082285.6985381, "message": "It's also useful when something returns a string. For instance, rather than doing this:\n\n> (foo)\n\"bar qux \\\"corge\\\"\"\n\nYou can use this:\n\n> (pr:foo)\nbar qux \"corge\"\nnil\n\nBut I found a different way of working around that with my tester library.", "group_id": 9739, "id": 1393676}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1308082347.929266, "message": "In any case, I would expect output from pr and prn (and err... and warn...) to appear in the final output.", "group_id": 9739, "id": 1393685}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1308082562.5176721, "message": "In other words, this:\n\n> foo\n\nEvaluates to this:\n\n((\"foo\" nil))\n\nAnd this:\n\n> foo\nnil\n\nEvaluates to this:\n\n((\"foo\" \"nil\"))", "group_id": 9739, "id": 1393711}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1308082520.7791131, "message": "Actually, I do. And I added it in with two lines. The way to distinguish it is that a test that expects nil doesn't care about the return value. But a test that expects \"nil\" expects the symbol nil as output.", "group_id": 9739, "id": 1393705}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1308082614.5434909, "message": "So by testing whether the expected output is nil (vs. a string) you can then ignore the results.", "group_id": 9739, "id": 1393716}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1308082679.3166671, "message": "With that change, my tester library now accepts input that doesn't care about it's output, like so:\n\n> (def foo ...)", "group_id": 9739, "id": 1393722}, {"user_id": 32737, "stars": [], "topic_id": 38193, "date_created": 1308082795.3786271, "message": "Because if foo doesn't print anything, the output of tostring will be \"\" so this lets you distinguish whether it printed something or not.", "group_id": 9739, "id": 1393744}] |