No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

70 líneas
1.7KB

  1. Option Explicit
  2. Dim app, ctrl, statusLine, contentType, body, pass
  3. pass = True
  4. On Error Resume Next
  5. Set app = CreateObject("WscMvc.Application")
  6. If Err.Number <> 0 Then
  7. WScript.Echo "FAIL: could not create WscMvc.Application - " & Err.Description
  8. pass = False
  9. Err.Clear
  10. End If
  11. On Error Goto 0
  12. If pass Then
  13. statusLine = ""
  14. contentType = ""
  15. body = ""
  16. On Error Resume Next
  17. app.Run "/hello", statusLine, contentType, body
  18. If Err.Number <> 0 Then
  19. WScript.Echo "FAIL: Application.Run raised error on /hello - " & Err.Description
  20. pass = False
  21. Err.Clear
  22. End If
  23. On Error Goto 0
  24. End If
  25. If pass Then
  26. If statusLine = "200 OK" And contentType = "text/html; charset=utf-8" And body = "Hello from WSC-MVC!" Then
  27. WScript.Echo "PASS: /hello -> " & statusLine & " | " & contentType & " | " & body
  28. Else
  29. WScript.Echo "FAIL: unexpected /hello result -> [" & statusLine & "] [" & contentType & "] [" & body & "]"
  30. pass = False
  31. End If
  32. End If
  33. If pass Then
  34. statusLine = ""
  35. contentType = ""
  36. body = ""
  37. On Error Resume Next
  38. app.Run "/does-not-exist", statusLine, contentType, body
  39. If Err.Number <> 0 Then
  40. WScript.Echo "FAIL: Application.Run raised error on unknown route - " & Err.Description
  41. pass = False
  42. Err.Clear
  43. End If
  44. On Error Goto 0
  45. End If
  46. If pass Then
  47. If statusLine = "404 Not Found" Then
  48. WScript.Echo "PASS: unknown route -> " & statusLine
  49. Else
  50. WScript.Echo "FAIL: unexpected unknown-route result -> [" & statusLine & "]"
  51. pass = False
  52. End If
  53. End If
  54. Set app = Nothing
  55. If pass Then
  56. WScript.Echo "RESULT: ALL PASS"
  57. WScript.Quit 0
  58. Else
  59. WScript.Echo "RESULT: FAILURE"
  60. WScript.Quit 1
  61. End If

Powered by TurnKey Linux.