[Wheat-cvs] r1/root/library base.ws,1.60,1.61
Status: Pre-Alpha
Brought to you by:
mark_lentczner
From: Kragen S. <kr...@us...> - 2005-06-07 22:33:58
|
Update of /cvsroot/wheat/r1/root/library In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6817/root/library Modified Files: base.ws Log Message: Thought I'd committed this yesterday, but apparently there was a network error. Now post-args is a table, not just a /library/base/object. Consequently it should now be safe to handle form posts with form field names like "absolute-path" and "member". Added comments on untested methods. Blog edit doesn't work, but I don't think that's a result of these changes. Index: base.ws =================================================================== RCS file: /cvsroot/wheat/r1/root/library/base.ws,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- base.ws 5 May 2005 17:42:25 -0000 1.60 +++ base.ws 7 Jun 2005 22:33:49 -0000 1.61 @@ -426,8 +426,19 @@ value-at(i): { return \#entries[i].value } clear(): { #entries := ???; } + + from-array(args): { + rv := {:'/library/base/table':} + ii := 0 + while (ii < args.size) { + rv[args[ii]] := args[ii + 1] + ii += 2 + } + return rv + } } + file: { -- public -- mime-type: {:'/library/base/primitive':} @@ -457,6 +468,15 @@ #assert-equals(false, t["bob"]!); } + test-table-some-more(): { + t := ($..).table.from-array(["bob", 3, "mary", 44, + "as-string", 55, "member", 666]) + #assert-equals(3, t["bob"]) + #assert-equals(44, t["mary"]) + #assert-equals(55, t["as-string"]) + #assert-equals(666, t["member"]) + } + test-string-as-path(): { path-string := "/library/wheatunit/test-case"; path := path-string.as-path(); |