oktest 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/misc_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.0.2 $
4
+ ### $Release: 1.1.0 $
5
5
  ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
data/test/node_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.0.2 $
4
+ ### $Release: 1.1.0 $
5
5
  ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.0.2 $
4
+ ### $Release: 1.1.0 $
5
5
  ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
@@ -418,6 +418,10 @@ Oktest.scope do
418
418
  end
419
419
  end
420
420
 
421
+ spec "last spec" do
422
+ ok {1+1} == 2
423
+ end
424
+
421
425
  end
422
426
 
423
427
  end
@@ -443,10 +447,11 @@ ZeroDivisionError: divided by 0
443
447
  END
444
448
 
445
449
  FOOTER = <<'END'
446
- ## total:8 (<B>pass:4</B>, <R>fail:1</R>, <R>error:1</R>, <Y>skip:1</Y>, <Y>todo:1</Y>) in 0.000s
450
+ ## total:9 (<B>pass:5</B>, <R>fail:1</R>, <R>error:1</R>, <Y>skip:1</Y>, <Y>todo:1</Y>) in 0.000s
447
451
  END
448
452
 
449
453
  VERBOSE_PART = <<'END'
454
+ ## _test.tmp
450
455
  * <b>Parent</b>
451
456
  * <b>Child1</b>
452
457
  - [<B>pass</B>] 1+1 should be 2
@@ -463,16 +468,28 @@ END
463
468
  - [<B>pass</B>] x*x is positive.
464
469
  - <b>Else</b>
465
470
  - [<B>pass</B>] x*x is also positive.
471
+ - [<B>pass</B>] last spec
466
472
  END
467
473
  VERBOSE_OUTPUT = VERBOSE_PART + ERROR_PART + VERBOSE_PART2 + FOOTER
468
474
 
469
475
  SIMPLE_PART = <<'END'
470
- _test.tmp: <B>.</B><B>.</B><R>f</R><R>E</R><Y>s</Y><Y>t</Y><B>.</B><B>.</B>
476
+ ## _test.tmp
477
+ * <b>Parent</b>: <B>.</B><B>.</B><B>.</B>
478
+ * <b>Child1</b>: <B>.</B><B>.</B>
479
+ * <b>Child2</b>: <R>f</R><R>E</R>
471
480
  END
472
- SIMPLE_OUTPUT = SIMPLE_PART + ERROR_PART + FOOTER
481
+ SIMPLE_PART2 = <<'END'
482
+ * <b>Child3</b>: <Y>s</Y><Y>t</Y>
483
+ END
484
+ SIMPLE_OUTPUT = SIMPLE_PART + ERROR_PART + SIMPLE_PART2 + FOOTER
485
+
486
+ COMPACT_PART = <<'END'
487
+ _test.tmp: <B>.</B><B>.</B><R>f</R><R>E</R><Y>s</Y><Y>t</Y><B>.</B><B>.</B><B>.</B>
488
+ END
489
+ COMPACT_OUTPUT = COMPACT_PART + ERROR_PART + FOOTER
473
490
 
474
491
  PLAIN_PART = <<'END'
475
- <B>.</B><B>.</B><R>f</R><R>E</R><Y>s</Y><Y>t</Y><B>.</B><B>.</B>
492
+ <B>.</B><B>.</B><R>f</R><R>E</R><Y>s</Y><Y>t</Y><B>.</B><B>.</B><B>.</B>
476
493
  END
477
494
  PLAIN_OUTPUT = PLAIN_PART + ERROR_PART + FOOTER
478
495
 
@@ -516,7 +533,7 @@ end
516
533
 
517
534
  class SimpleReporter_TC < Reporter_TC
518
535
 
519
- it "[!xfd5o] reports filename." do
536
+ it "[!jxa1b] reports topics and progress." do
520
537
  sout, serr = run("-ss", @filename)
521
538
  assert_eq edit_actual(sout), edit_expected(SIMPLE_OUTPUT)
522
539
  assert_eq serr, ""
@@ -525,6 +542,17 @@ class SimpleReporter_TC < Reporter_TC
525
542
  end
526
543
 
527
544
 
545
+ class CompactReporter_TC < Reporter_TC
546
+
547
+ it "[!xfd5o] reports filename." do
548
+ sout, serr = run("-sc", @filename)
549
+ assert_eq edit_actual(sout), edit_expected(COMPACT_OUTPUT)
550
+ assert_eq serr, ""
551
+ end
552
+
553
+ end
554
+
555
+
528
556
  class PlainReporter_TC < Reporter_TC
529
557
 
530
558
  it "[!w842j] reports progress." do
data/test/runner_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.0.2 $
4
+ ### $Release: 1.1.0 $
5
5
  ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
@@ -44,6 +44,10 @@ class Runner_TC < TC
44
44
  def counts; {}; end
45
45
  end
46
46
 
47
+ class DummyReporter2 < DummyReporter
48
+ def order_policy; :spec_first; end
49
+ end
50
+
47
51
  describe "#start()" do
48
52
  build_topics = proc {
49
53
  Oktest.scope do
@@ -389,6 +393,47 @@ topic: "Parent"
389
393
  /topic
390
394
  [all] after_all
391
395
  /file
396
+ END
397
+ assert_eq sout, expected
398
+ assert_eq serr, ""
399
+ end
400
+ it "[!p3a5o] run specs and case_when in advance of specs and topics when SimpleReporter." do
401
+ sout, serr = capture do
402
+ Oktest.scope do
403
+ topic "T1" do
404
+ topic "T2" do
405
+ spec("S1") { ok {1+1} == 2 }
406
+ end
407
+ spec("S2") { ok {1+1} == 2 }
408
+ topic "T3" do
409
+ spec("S3") { ok {1+1} == 2 }
410
+ end
411
+ case_when "T4" do
412
+ spec("S4") { ok {1+1} == 2 }
413
+ end
414
+ end
415
+ end
416
+ Oktest::Runner.new(DummyReporter2.new).start()
417
+ end
418
+ expected = <<'END'
419
+ file: "test/runner_test.rb"
420
+ topic: "T1"
421
+ spec: "S2"
422
+ /spec: status=:PASS
423
+ topic: "When T4"
424
+ spec: "S4"
425
+ /spec: status=:PASS
426
+ /topic
427
+ topic: "T2"
428
+ spec: "S1"
429
+ /spec: status=:PASS
430
+ /topic
431
+ topic: "T3"
432
+ spec: "S3"
433
+ /spec: status=:PASS
434
+ /topic
435
+ /topic
436
+ /file
392
437
  END
393
438
  assert_eq sout, expected
394
439
  assert_eq serr, ""
@@ -417,6 +462,46 @@ file: "test/runner_test.rb"
417
462
  [all] before_all#2
418
463
  [all] after_all#2
419
464
  /file
465
+ END
466
+ assert_eq sout, expected
467
+ assert_eq serr, ""
468
+ end
469
+ it "[!c5cw0] run specs and case_when in advance of specs and topics when SimpleReporter." do
470
+ sout, serr = capture do
471
+ Oktest.scope do
472
+ topic "T1" do
473
+ spec("S1") { ok {1+1} == 2 }
474
+ end
475
+ spec("S2") { ok {1+1} == 2 }
476
+ case_when "T2" do
477
+ spec("S3") { ok {1+1} == 2 }
478
+ end
479
+ topic "T3" do
480
+ spec("S4") { ok {1+1} == 2 }
481
+ end
482
+ spec("S5") { ok {1+1} == 2 }
483
+ end
484
+ Oktest::Runner.new(DummyReporter2.new).start()
485
+ end
486
+ expected = <<'END'
487
+ file: "test/runner_test.rb"
488
+ spec: "S2"
489
+ /spec: status=:PASS
490
+ topic: "When T2"
491
+ spec: "S3"
492
+ /spec: status=:PASS
493
+ /topic
494
+ spec: "S5"
495
+ /spec: status=:PASS
496
+ topic: "T1"
497
+ spec: "S1"
498
+ /spec: status=:PASS
499
+ /topic
500
+ topic: "T3"
501
+ spec: "S4"
502
+ /spec: status=:PASS
503
+ /topic
504
+ /file
420
505
  END
421
506
  assert_eq sout, expected
422
507
  assert_eq serr, ""
@@ -474,12 +559,13 @@ class RunnerFunctions_TC < TC
474
559
  end
475
560
 
476
561
  VERBOSE_OUTPUT = <<'END'
562
+ ## test/runner_test.rb
477
563
  * <b>Example</b>
478
564
  - [<B>pass</B>] 1+1 should be 2
479
565
  - [<B>pass</B>] 1-1 should be 0
480
566
  ## total:2 (<B>pass:2</B>, fail:0, error:0, skip:0, todo:0) in 0.000s
481
567
  END
482
- SIMPLE_OUTPUT = <<'END'
568
+ COMPACT_OUTPUT = <<'END'
483
569
  test/runner_test.rb: <B>.</B><B>.</B>
484
570
  ## total:2 (<B>pass:2</B>, fail:0, error:0, skip:0, todo:0) in 0.000s
485
571
  END
@@ -509,9 +595,9 @@ END
509
595
  assert_eq edit_actual(sout), edit_expected(expected)
510
596
  assert_eq serr, ""
511
597
  #
512
- expected = SIMPLE_OUTPUT
598
+ expected = COMPACT_OUTPUT
513
599
  prepare()
514
- sout, serr = capture { Oktest.run(:style=>"simple") }
600
+ sout, serr = capture { Oktest.run(:style=>"compact") }
515
601
  assert_eq edit_actual(sout), edit_expected(expected)
516
602
  assert_eq serr, ""
517
603
  #
data/test/util_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.0.2 $
4
+ ### $Release: 1.1.0 $
5
5
  ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
data/test/visitor_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.0.2 $
4
+ ### $Release: 1.1.0 $
5
5
  ### $Copyright: copyright(c) 2011-2021 kuwata-lab.com all rights reserved $
6
6
  ### $License: MIT License $
7
7
  ###
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oktest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kwatch
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-04 00:00:00.000000000 Z
11
+ date: 2021-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs
@@ -70,6 +70,7 @@ files:
70
70
  - test/helper_test.rb
71
71
  - test/initialize.rb
72
72
  - test/mainapp_test.rb
73
+ - test/matcher_test.rb
73
74
  - test/misc_test.rb
74
75
  - test/node_test.rb
75
76
  - test/reporter_test.rb
@@ -82,7 +83,7 @@ homepage: https://github.com/kwatch/oktest/tree/ruby
82
83
  licenses:
83
84
  - MIT
84
85
  metadata: {}
85
- post_install_message:
86
+ post_install_message:
86
87
  rdoc_options: []
87
88
  require_paths:
88
89
  - lib
@@ -97,9 +98,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
98
  - !ruby/object:Gem::Version
98
99
  version: '0'
99
100
  requirements: []
100
- rubyforge_project:
101
- rubygems_version: 2.5.2.3
102
- signing_key:
101
+ rubygems_version: 3.2.22
102
+ signing_key:
103
103
  specification_version: 4
104
104
  summary: new style testing library
105
105
  test_files: