Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update the other two examples too

  • Loading branch information...
commit 1e6d609fd45c0c717e049eec2ca1bea8b5a0c555 1 parent 3cb44fd
@creationix authored
Showing with 10 additions and 5 deletions.
  1. +3 −3 test-http.can
  2. +7 −2 test-objects.can
View
6 test-http.can
@@ -1,10 +1,10 @@
require = global.require
-
+p = global.prettyPrint
print = global.print
throw = (err) {
- print(err.name + ": " + err.error)
+ p(err)
global.exit()
}
@@ -17,4 +17,4 @@ check = (status) {
url = "http://candor.io:8080/foo/bar/baz.zip?magic=yes#instant"
-p("parsed", global.HttpParser.parseUrl(url))
+p("parsed", require('http_parser').parseUrl(url))
View
9 test-objects.can
@@ -1,4 +1,5 @@
print = global.print
+p = global.prettyPrint
Rectangle = {}
Rectangle.getArea = (self) {
@@ -8,17 +9,21 @@ Rectangle.initialize = (self, w, h) {
self.w = w
self.h = h
}
+p("Rectangle", Rectangle)
Square = new Rectangle
Square.initialize = (self, s) {
self.w = s
self.h = s
}
+p("Square", Square)
rect = new Rectangle
rect:initialize(3, 5)
-print("Rectangle 3x5 =", rect:getArea())
+p("rect", rect)
+print("Rectangle 3x5 = " + rect:getArea())
square = new Square
square:initialize(4)
-print("Square 4x4 =", square:getArea())
+p("square", square)
+print("Square 4x4 = " + square:getArea())
Please sign in to comment.
Something went wrong with that request. Please try again.