Megatest

Diff
Login

Differences From Artifact [0e3e1ff756]:

To Artifact [b48b7cef02]:


1
2
3
4
5
6
7
8
9
10
11
12
13



14
15
16


17
18
19


20
21
22


23
24
25


26
27
28


29
30
31
32


33
34
35
36
37
38
39
40

41
42
43
44
45

46
47

48
49
50

51
52
53
54

55
56

57
58
59
60

61
62

63
64
65
66
67
68
69

70
71
72
73
74
75
76
1
2
3
4
5
6
7
8
9
10



11
12
13
14


15
16
17


18
19
20


21
22
23


24
25
26


27
28
29
30


31
32
33
34
35
36
37
38
39

40
41
42
43
44

45
46

47
48
49

50
51
52
53

54
55

56
57
58
59

60
61

62
63
64
65
66
67
68

69
70
71
72
73
74
75
76










-
-
-
+
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+


-
-
+
+







-
+




-
+

-
+


-
+



-
+

-
+



-
+

-
+






-
+







#!/usr/bin/env csi -script
(use test)
(include "ducttape-lib.scm")
(import ducttape-lib)
(import ansi-escape-sequences)
(use trace)
(set! systype (do-or-die (if (file-exists? "/bin/uname") "/bin/uname" "/usr/bin/uname")))
;(trace skim-cmdline-opts-withargs-by-regex)
;(trace keyword-skim)
;(trace re-match?)
(define (reset-glib)
  (unsetenv "GLIB_DEBUG_LEVEL")
  (glib-debug-level #f)
(define (reset-ducttape)
  (unsetenv "ducttape_DEBUG_LEVEL")
  (ducttape-debug-level #f)

  (unsetenv "GLIB_DEBUG_PATTERN")
  (glib-debug-regex-filter ".")
  (unsetenv "ducttape_DEBUG_PATTERN")
  (ducttape-debug-regex-filter ".")

  (unsetenv "GLIB_LOG_FILE")
  (glib-log-file #f)
  (unsetenv "ducttape_LOG_FILE")
  (ducttape-log-file #f)

  (unsetenv "GLIB_SILENT_MODE")
  (glib-silent-mode #f)
  (unsetenv "ducttape_SILENT_MODE")
  (ducttape-silent-mode #f)

  (unsetenv "GLIB_QUIET_MODE")
  (glib-quiet-mode #f)
  (unsetenv "ducttape_QUIET_MODE")
  (ducttape-quiet-mode #f)

  (unsetenv "GLIB_COLOR_MODE")
  (glib-color-mode #f)
  (unsetenv "ducttape_COLOR_MODE")
  (ducttape-color-mode #f)
)

(define (reset-glib-with-cmdline-list cmdline-list)
  (reset-glib)
(define (reset-ducttape-with-cmdline-list cmdline-list)
  (reset-ducttape)

  (command-line-arguments cmdline-list)
  (process-command-line)
)


(define (direct-iputs-test)
  (glib-color-mode #f)
  (ducttape-color-mode #f)
  (ierr "I'm an error")
  (iwarn "I'm a warning")
  (inote "I'm a note")

  (glib-debug-level 1)
  (ducttape-debug-level 1)
  (idbg "I'm a debug statement")
  (glib-debug-level #f)
  (ducttape-debug-level #f)
  (idbg "I'm a hidden debug statement")

  (glib-silent-mode #t)
  (ducttape-silent-mode #t)
  (iwarn "I shouldn't show up")
  (inote "I shouldn't show up either")
  (ierr "I should show up 1")
  (glib-silent-mode #f)
  (ducttape-silent-mode #f)

  (glib-quiet-mode #t)
  (ducttape-quiet-mode #t)
  (iwarn "I should show up 2")
  (inote "I shouldn't show up though")
  (ierr "I should show up 3")
  (glib-quiet-mode #f)
  (ducttape-quiet-mode #f)

  (glib-debug-level 1)
  (ducttape-debug-level 1)
  (idbg "foo")
  (iputs "dbg" "debug message")
  (iputs "e" "error message")
  (iputs "w" "warning message")
  (iputs "n" "note message")

  (glib-color-mode #t)
  (ducttape-color-mode #t)
  (ierr "I'm an error COLOR")
  (iwarn "I'm a warning COLOR")
  (inote "I'm a note COLOR")
  (idbg "I'm a debug COLOR")


  )
238
239
240
241
242
243
244
245
246
247
248
249
250
251







252
253
254


255
256
257


258
259
260


261
262
263


264
265
266


267
268
269


270
271
272


273
274
275


276
277
278


279
280
281


282
283
284


285
286
287


288
289
290
291
292
293
294
238
239
240
241
242
243
244







245
246
247
248
249
250
251
252


253
254
255


256
257
258


259
260
261


262
263
264


265
266
267


268
269
270


271
272
273


274
275
276


277
278
279


280
281
282


283
284
285


286
287
288
289
290
291
292
293
294







-
-
-
-
-
-
-
+
+
+
+
+
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+

-
-
+
+







  ) ; end define

   
(define (test-argprocessor )
  (test-group
   "Command line processor parameter settings"

   (reset-glib-with-cmdline-list '())
   (test-assert "(nil) debug mode should be off" (not (glib-debug-level)))
   (test-assert "(nil): debug pattern should be '.'" (equal? "." (glib-debug-regex-filter)))
   (test-assert "(nil): colors should be off" (not (glib-color-mode)))
   (test-assert "(nil): silent mode should be off" (not (glib-silent-mode)))
   (test-assert "(nil): quiet mode should be off" (not (glib-quiet-mode)))
   (test-assert "(nil): logfile should be off" (not (glib-log-file)))
   (reset-ducttape-with-cmdline-list '())
   (test-assert "(nil) debug mode should be off" (not (ducttape-debug-level)))
   (test-assert "(nil): debug pattern should be '.'" (equal? "." (ducttape-debug-regex-filter)))
   (test-assert "(nil): colors should be off" (not (ducttape-color-mode)))
   (test-assert "(nil): silent mode should be off" (not (ducttape-silent-mode)))
   (test-assert "(nil): quiet mode should be off" (not (ducttape-quiet-mode)))
   (test-assert "(nil): logfile should be off" (not (ducttape-log-file)))

   (reset-glib-with-cmdline-list '("-d"))
   (test-assert "-d: debug mode should be on at level 1" (eq? 1 (glib-debug-level)))
   (reset-ducttape-with-cmdline-list '("-d"))
   (test-assert "-d: debug mode should be on at level 1" (eq? 1 (ducttape-debug-level)))

   (reset-glib-with-cmdline-list '("-dd"))
   (test "-dd: debug level should be 2" 2 (glib-debug-level))
   (reset-ducttape-with-cmdline-list '("-dd"))
   (test "-dd: debug level should be 2" 2 (ducttape-debug-level))

   (reset-glib-with-cmdline-list '("-ddd"))
   (test "-ddd: debug level should be 3" 3 (glib-debug-level))
   (reset-ducttape-with-cmdline-list '("-ddd"))
   (test "-ddd: debug level should be 3" 3 (ducttape-debug-level))

   (reset-glib-with-cmdline-list '("-d2"))
   (test "-d2: debug level should be 2" 2 (glib-debug-level))
   (reset-ducttape-with-cmdline-list '("-d2"))
   (test "-d2: debug level should be 2" 2 (ducttape-debug-level))

   (reset-glib-with-cmdline-list '("-d3"))
   (test "-d3: debug level should be 3" 3 (glib-debug-level))
   (reset-ducttape-with-cmdline-list '("-d3"))
   (test "-d3: debug level should be 3" 3 (ducttape-debug-level))

   (reset-glib-with-cmdline-list '("-dp" "foo"))
   (test "-dp foo: debug pattern should be 'foo'" "foo" (glib-debug-regex-filter))
   (reset-ducttape-with-cmdline-list '("-dp" "foo"))
   (test "-dp foo: debug pattern should be 'foo'" "foo" (ducttape-debug-regex-filter))

   (reset-glib-with-cmdline-list '("--debug-pattern" "foo"))
   (test "--debug-pattern foo: debug pattern should be 'foo'" "foo" (glib-debug-regex-filter))
   (reset-ducttape-with-cmdline-list '("--debug-pattern" "foo"))
   (test "--debug-pattern foo: debug pattern should be 'foo'" "foo" (ducttape-debug-regex-filter))

   (reset-glib-with-cmdline-list '("-dp" "foo" "-dp" "bar"))
   (test "-dp foo -dp bar: debug pattern should be 'foo|bar'"  "foo|bar" (glib-debug-regex-filter))
   (reset-ducttape-with-cmdline-list '("-dp" "foo" "-dp" "bar"))
   (test "-dp foo -dp bar: debug pattern should be 'foo|bar'"  "foo|bar" (ducttape-debug-regex-filter))

   (reset-glib-with-cmdline-list '("--quiet"))
   (test-assert "-quiet: quiet mode should be active" (glib-quiet-mode))
   (reset-ducttape-with-cmdline-list '("--quiet"))
   (test-assert "-quiet: quiet mode should be active" (ducttape-quiet-mode))

   (reset-glib-with-cmdline-list '("--silent"))
   (test-assert "-silent: silent mode should be active" (glib-silent-mode))
   (reset-ducttape-with-cmdline-list '("--silent"))
   (test-assert "-silent: silent mode should be active" (ducttape-silent-mode))

   (reset-glib-with-cmdline-list '("--color"))
   (test-assert "-color: color mode should be active" (glib-color-mode))
   (reset-ducttape-with-cmdline-list '("--color"))
   (test-assert "-color: color mode should be active" (ducttape-color-mode))

   (reset-glib-with-cmdline-list '("--log" "foo"))
   (test "--log foo: logfile should be 'foo'" "foo" (glib-log-file))
   (reset-ducttape-with-cmdline-list '("--log" "foo"))
   (test "--log foo: logfile should be 'foo'" "foo" (ducttape-log-file))

))

(define (test-wwdate)
  (test-group
   "wwdate conversion tests"
   (let ((test-table
323
324
325
326
327
328
329
330

331
332

333
334
335
336
337
338
339
340
341
342
343
344
345
323
324
325
326
327
328
329

330
331

332
333
334
335
336
337
338
339
340
341
342
343
344
345







-
+

-
+













;              (test "settext bold" "\x1b[1mfoo\x1b[0m" (set-text (list 'bold) "foo"))
;              )

  ; visually inspect this
  (direct-iputs-test)

  ; following use unit test test-egg
  (reset-glib)
  (reset-ducttape)
  (test-argprocessor-funcs)
  (reset-glib)
  (reset-ducttape)
  (test-argprocessor)
  (test-systemstuff)
  (test-misc)
  (test-wwdate)
  ) ; end main()

(main)
(sendmail "brandon.j.barclay@intel.com" "6hello subject"  "test body")
;(sendmail "bjbarcla" "2hello subject html"  "test body<h1>hello</h1><i>italics</i>" use_html: #t)
;(sendmail "bb" "4hello attach subject html"  "<h2>hmm</h2>" use_html: #t attach-files-list: '( "/Users/bb/Downloads/wdmycloud-manual-4779-705103.pdf" ) )

;(launch-repl)
(test-exit)