cairo 1.8.5-x86-mingw32 → 1.10.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of cairo might be problematic. Click here for more details.
- data/NEWS +2 -2
- data/Rakefile +44 -7
- data/ext/cairo/cairo.def +28 -1
- data/ext/cairo/extconf.rb +14 -16
- data/ext/cairo/rb_cairo.c +4 -1
- data/ext/cairo/rb_cairo.h +65 -1
- data/ext/cairo/rb_cairo_constants.c +150 -3
- data/ext/cairo/rb_cairo_context.c +17 -0
- data/ext/cairo/rb_cairo_device.c +406 -0
- data/ext/cairo/rb_cairo_exception.c +83 -32
- data/ext/cairo/rb_cairo_io.c +166 -0
- data/ext/cairo/rb_cairo_io.h +44 -0
- data/ext/cairo/rb_cairo_matrix.c +1 -1
- data/ext/cairo/rb_cairo_private.h +3 -0
- data/ext/cairo/rb_cairo_region.c +385 -0
- data/ext/cairo/rb_cairo_surface.c +674 -199
- data/lib/1.8/cairo.so +0 -0
- data/lib/1.9/cairo.so +0 -0
- data/samples/blur.rb +2 -3
- data/samples/{pac2.rb → pac-nomralize.rb} +5 -6
- data/samples/pac-tee.rb +170 -0
- data/samples/pac.rb +2 -3
- data/samples/png.rb +2 -3
- data/samples/scalable.rb +2 -3
- data/samples/text-on-path.rb +2 -3
- data/samples/text2.rb +2 -3
- data/test/cairo-test-utils.rb +15 -0
- data/test/run-test.rb +5 -4
- data/test/test_context.rb +4 -4
- data/test/test_font_face.rb +34 -21
- data/test/test_recording_surface.rb +18 -0
- data/test/test_region.rb +102 -0
- data/test/test_script_device.rb +46 -0
- data/test/test_script_surface.rb +13 -0
- data/test/test_surface.rb +14 -4
- data/test/test_tee_surface.rb +32 -0
- data/test/test_xml_device.rb +22 -0
- data/test/test_xml_surface.rb +32 -0
- data/tmp/i386-mingw32/cairo/1.9.2/rbconfig.rb +1 -1
- data/vendor/local/bin/libcairo-2.dll +0 -0
- data/vendor/local/include/cairo/cairo-deprecated.h +1 -16
- data/vendor/local/include/cairo/cairo-features.h +7 -0
- data/vendor/local/include/cairo/cairo-ft.h +16 -9
- data/vendor/local/include/cairo/cairo-gobject.h +186 -0
- data/vendor/local/include/cairo/cairo-pdf.h +27 -1
- data/vendor/local/include/cairo/cairo-ps.h +1 -1
- data/vendor/local/include/cairo/cairo-script-interpreter.h +117 -0
- data/vendor/local/include/cairo/cairo-svg.h +1 -1
- data/vendor/local/include/cairo/cairo-version.h +2 -2
- data/vendor/local/include/cairo/cairo-win32.h +1 -1
- data/vendor/local/include/cairo/cairo.h +382 -26
- data/vendor/local/lib/cairo.def +44 -0
- data/vendor/local/lib/cairo.lib +0 -0
- data/vendor/local/lib/libcairo.dll.a +0 -0
- data/vendor/local/lib/pkgconfig/cairo-fc.pc +12 -0
- data/vendor/local/lib/pkgconfig/cairo-ft.pc +4 -4
- data/vendor/local/lib/pkgconfig/cairo-gobject.pc +12 -0
- data/vendor/local/lib/pkgconfig/cairo-pdf.pc +3 -3
- data/vendor/local/lib/pkgconfig/cairo-png.pc +3 -3
- data/vendor/local/lib/pkgconfig/cairo-ps.pc +3 -3
- data/vendor/local/lib/pkgconfig/cairo-svg.pc +3 -3
- data/vendor/local/lib/pkgconfig/cairo-win32-font.pc +3 -3
- data/vendor/local/lib/pkgconfig/cairo-win32.pc +3 -3
- data/vendor/local/lib/pkgconfig/cairo.pc +4 -4
- data/vendor/local/manifest/{cairo-dev_1.8.10-4_win32.mft → cairo-dev_1.10.0-1_win32.mft} +34 -27
- data/vendor/local/manifest/cairo_1.10.0-1_win32.mft +5 -0
- data/vendor/local/share/doc/{cairo_1.8.10-4_win32 → cairo_1.10.0-1_win32}/COPYING +9 -8
- data/vendor/local/share/doc/{cairo_1.8.10-4_win32 → cairo_1.10.0-1_win32}/COPYING-LGPL-2.1 +2 -2
- data/vendor/local/share/doc/{cairo_1.8.10-4_win32 → cairo_1.10.0-1_win32}/COPYING-MPL-1.1 +0 -0
- data/vendor/local/share/gtk-doc/html/cairo/bindings-errors.html +4 -14
- data/vendor/local/share/gtk-doc/html/cairo/bindings-fonts.html +5 -15
- data/vendor/local/share/gtk-doc/html/cairo/bindings-memory.html +7 -17
- data/vendor/local/share/gtk-doc/html/cairo/bindings-overloading.html +6 -16
- data/vendor/local/share/gtk-doc/html/cairo/bindings-path.html +6 -16
- data/vendor/local/share/gtk-doc/html/cairo/bindings-patterns.html +23 -28
- data/vendor/local/share/gtk-doc/html/cairo/bindings-return-values.html +3 -13
- data/vendor/local/share/gtk-doc/html/cairo/bindings-streams.html +3 -13
- data/vendor/local/share/gtk-doc/html/cairo/bindings-surfaces.html +7 -17
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Error-handling.html +373 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-FreeType-Fonts.html +330 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Image-Surfaces.html +478 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-PDF-Surfaces.html +344 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-PNG-Support.html +320 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Paths.html +1291 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-PostScript-Surfaces.html +622 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Quartz-(CGFont)-Fonts.html +134 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Quartz-Surfaces.html +210 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Regions.html +834 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-SVG-Surfaces.html +318 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Transformations.html +410 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Types.html +169 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-User-Fonts.html +715 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Version-Information.html +410 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Win32-Fonts.html +335 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-Win32-Surfaces.html +291 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-XLib-Surfaces.html +470 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-device-t.html +595 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-font-face-t.html +384 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-font-options-t.html +644 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-matrix-t.html +574 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-pattern-t.html +1457 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-scaled-font-t.html +1076 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html +1396 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-t.html +2743 -0
- data/vendor/local/share/gtk-doc/html/cairo/cairo-drawing.html +13 -20
- data/vendor/local/share/gtk-doc/html/cairo/cairo-fonts.html +13 -23
- data/vendor/local/share/gtk-doc/html/cairo/cairo-support.html +11 -21
- data/vendor/local/share/gtk-doc/html/cairo/cairo-surfaces.html +19 -26
- data/vendor/local/share/gtk-doc/html/cairo/cairo-text.html +279 -326
- data/vendor/local/share/gtk-doc/html/cairo/cairo.devhelp +411 -355
- data/vendor/local/share/gtk-doc/html/cairo/cairo.devhelp2 +579 -480
- data/vendor/local/share/gtk-doc/html/cairo/index-1.10.html +147 -0
- data/vendor/local/share/gtk-doc/html/cairo/index-1.2.html +88 -65
- data/vendor/local/share/gtk-doc/html/cairo/index-1.4.html +72 -47
- data/vendor/local/share/gtk-doc/html/cairo/index-1.6.html +43 -32
- data/vendor/local/share/gtk-doc/html/cairo/index-1.8.html +42 -41
- data/vendor/local/share/gtk-doc/html/cairo/index-all.html +542 -345
- data/vendor/local/share/gtk-doc/html/cairo/index.html +36 -39
- data/vendor/local/share/gtk-doc/html/cairo/index.sgml +674 -444
- data/vendor/local/share/gtk-doc/html/cairo/language-bindings.html +6 -16
- data/vendor/local/share/gtk-doc/html/cairo/style.css +152 -54
- data/vendor/local/src/tml/packaging/cairo_1.10.0-1_win32.log +1262 -0
- data/vendor/local/src/tml/packaging/{cairo_1.8.10-4_win32.sh → cairo_1.10.0-1_win32.sh} +3 -3
- metadata +137 -389
- data/doc/doc.css +0 -91
- data/doc/en/cairo-antialias.html +0 -38
- data/doc/en/cairo-clip-not-representable-error.html +0 -47
- data/doc/en/cairo-color-base.html +0 -69
- data/doc/en/cairo-color-cmyk.html +0 -157
- data/doc/en/cairo-color-hsv.html +0 -137
- data/doc/en/cairo-color-rgb.html +0 -142
- data/doc/en/cairo-color-x11.html +0 -173
- data/doc/en/cairo-color.html +0 -238
- data/doc/en/cairo-content.html +0 -37
- data/doc/en/cairo-context-blur.html +0 -39
- data/doc/en/cairo-context-circle.html +0 -39
- data/doc/en/cairo-context-color.html +0 -39
- data/doc/en/cairo-context-path.html +0 -44
- data/doc/en/cairo-context-rectangle.html +0 -39
- data/doc/en/cairo-context-triangle.html +0 -39
- data/doc/en/cairo-context.html +0 -643
- data/doc/en/cairo-error.html +0 -44
- data/doc/en/cairo-extend.html +0 -38
- data/doc/en/cairo-file-not-found.html +0 -47
- data/doc/en/cairo-fill-rule.html +0 -36
- data/doc/en/cairo-filter.html +0 -40
- data/doc/en/cairo-font-extents.html +0 -129
- data/doc/en/cairo-font-face.html +0 -38
- data/doc/en/cairo-font-options.html +0 -139
- data/doc/en/cairo-font-slant.html +0 -37
- data/doc/en/cairo-font-type-mismatch.html +0 -47
- data/doc/en/cairo-font-weight.html +0 -36
- data/doc/en/cairo-format.html +0 -46
- data/doc/en/cairo-glyph.html +0 -99
- data/doc/en/cairo-gradient-pattern.html +0 -74
- data/doc/en/cairo-hint-metrics.html +0 -37
- data/doc/en/cairo-hint-style.html +0 -39
- data/doc/en/cairo-image-surface.html +0 -82
- data/doc/en/cairo-invalid-clusters.html +0 -47
- data/doc/en/cairo-invalid-content-error.html +0 -47
- data/doc/en/cairo-invalid-dash-error.html +0 -47
- data/doc/en/cairo-invalid-dsc-comment-error.html +0 -47
- data/doc/en/cairo-invalid-format-error.html +0 -47
- data/doc/en/cairo-invalid-index-error.html +0 -47
- data/doc/en/cairo-invalid-matrix-error.html +0 -47
- data/doc/en/cairo-invalid-path-data-error.html +0 -47
- data/doc/en/cairo-invalid-pop-group-error.html +0 -47
- data/doc/en/cairo-invalid-restore-error.html +0 -47
- data/doc/en/cairo-invalid-slant.html +0 -47
- data/doc/en/cairo-invalid-status-error.html +0 -47
- data/doc/en/cairo-invalid-stride-error.html +0 -47
- data/doc/en/cairo-invalid-string-error.html +0 -47
- data/doc/en/cairo-invalid-visual-error.html +0 -47
- data/doc/en/cairo-invalid-weight.html +0 -47
- data/doc/en/cairo-line-cap.html +0 -37
- data/doc/en/cairo-line-join.html +0 -37
- data/doc/en/cairo-linear-pattern.html +0 -60
- data/doc/en/cairo-matrix.html +0 -259
- data/doc/en/cairo-negative-count.html +0 -47
- data/doc/en/cairo-no-current-point-error.html +0 -47
- data/doc/en/cairo-null-pointer-error.html +0 -47
- data/doc/en/cairo-operator.html +0 -48
- data/doc/en/cairo-paper-parse-error.html +0 -47
- data/doc/en/cairo-paper-unknown-paper-name.html +0 -66
- data/doc/en/cairo-paper-unknown-unit.html +0 -66
- data/doc/en/cairo-paper-unrecognized-paper-description.html +0 -66
- data/doc/en/cairo-paper.html +0 -184
- data/doc/en/cairo-path-close-path.html +0 -49
- data/doc/en/cairo-path-curve-to.html +0 -49
- data/doc/en/cairo-path-data-type.html +0 -38
- data/doc/en/cairo-path-data.html +0 -98
- data/doc/en/cairo-path-line-to.html +0 -49
- data/doc/en/cairo-path-move-to.html +0 -49
- data/doc/en/cairo-path.html +0 -155
- data/doc/en/cairo-pattern-type-mismatch-error.html +0 -47
- data/doc/en/cairo-pattern.html +0 -99
- data/doc/en/cairo-pdf-surface.html +0 -57
- data/doc/en/cairo-point.html +0 -74
- data/doc/en/cairo-ps-level.html +0 -49
- data/doc/en/cairo-ps-surface.html +0 -92
- data/doc/en/cairo-quartz-image-surface.html +0 -57
- data/doc/en/cairo-quartz-surface.html +0 -57
- data/doc/en/cairo-radial-pattern.html +0 -60
- data/doc/en/cairo-read-error.html +0 -47
- data/doc/en/cairo-rectangle.html +0 -89
- data/doc/en/cairo-scaled-font.html +0 -94
- data/doc/en/cairo-solid-pattern.html +0 -62
- data/doc/en/cairo-subpixel-order.html +0 -39
- data/doc/en/cairo-surface-finished-error.html +0 -47
- data/doc/en/cairo-surface-pattern.html +0 -57
- data/doc/en/cairo-surface-type-mismatch-error.html +0 -47
- data/doc/en/cairo-surface.html +0 -121
- data/doc/en/cairo-svg-surface.html +0 -77
- data/doc/en/cairo-svg-version.html +0 -49
- data/doc/en/cairo-temp-file-error.html +0 -47
- data/doc/en/cairo-text-cluster-flag.html +0 -35
- data/doc/en/cairo-text-cluster.html +0 -84
- data/doc/en/cairo-text-extents.html +0 -144
- data/doc/en/cairo-toy-font-face.html +0 -67
- data/doc/en/cairo-user-font-error.html +0 -47
- data/doc/en/cairo-user-font-face-text-to-glyphs-data.html +0 -94
- data/doc/en/cairo-user-font-face.html +0 -72
- data/doc/en/cairo-user-font-immutable.html +0 -47
- data/doc/en/cairo-win32-printing-surface.html +0 -57
- data/doc/en/cairo-win32-surface.html +0 -62
- data/doc/en/cairo-write-error.html +0 -47
- data/doc/en/cairo.html +0 -131
- data/doc/en/index.html +0 -1154
- data/doc/index.html +0 -18
- data/doc/ja/cairo-antialias.html +0 -57
- data/doc/ja/cairo-clip-not-representable-error.html +0 -56
- data/doc/ja/cairo-color-base.html +0 -75
- data/doc/ja/cairo-color-cmyk.html +0 -152
- data/doc/ja/cairo-color-hsv.html +0 -135
- data/doc/ja/cairo-color-rgb.html +0 -145
- data/doc/ja/cairo-color-x11.html +0 -183
- data/doc/ja/cairo-color.html +0 -317
- data/doc/ja/cairo-content.html +0 -51
- data/doc/ja/cairo-context-blur.html +0 -53
- data/doc/ja/cairo-context-circle.html +0 -54
- data/doc/ja/cairo-context-color.html +0 -52
- data/doc/ja/cairo-context-path.html +0 -77
- data/doc/ja/cairo-context-rectangle.html +0 -60
- data/doc/ja/cairo-context-triangle.html +0 -47
- data/doc/ja/cairo-context.html +0 -1542
- data/doc/ja/cairo-error.html +0 -56
- data/doc/ja/cairo-extend.html +0 -56
- data/doc/ja/cairo-file-not-found.html +0 -51
- data/doc/ja/cairo-fill-rule.html +0 -58
- data/doc/ja/cairo-filter.html +0 -43
- data/doc/ja/cairo-font-extents.html +0 -164
- data/doc/ja/cairo-font-face.html +0 -55
- data/doc/ja/cairo-font-options.html +0 -189
- data/doc/ja/cairo-font-slant.html +0 -50
- data/doc/ja/cairo-font-type-mismatch.html +0 -52
- data/doc/ja/cairo-font-weight.html +0 -47
- data/doc/ja/cairo-format.html +0 -81
- data/doc/ja/cairo-glyph.html +0 -115
- data/doc/ja/cairo-gradient-pattern.html +0 -119
- data/doc/ja/cairo-hint-metrics.html +0 -57
- data/doc/ja/cairo-hint-style.html +0 -64
- data/doc/ja/cairo-image-surface.html +0 -131
- data/doc/ja/cairo-invalid-clusters.html +0 -55
- data/doc/ja/cairo-invalid-content-error.html +0 -54
- data/doc/ja/cairo-invalid-dash-error.html +0 -54
- data/doc/ja/cairo-invalid-dsc-comment-error.html +0 -54
- data/doc/ja/cairo-invalid-format-error.html +0 -54
- data/doc/ja/cairo-invalid-index-error.html +0 -54
- data/doc/ja/cairo-invalid-matrix-error.html +0 -54
- data/doc/ja/cairo-invalid-path-data-error.html +0 -54
- data/doc/ja/cairo-invalid-pop-group-error.html +0 -54
- data/doc/ja/cairo-invalid-restore-error.html +0 -55
- data/doc/ja/cairo-invalid-slant.html +0 -57
- data/doc/ja/cairo-invalid-status-error.html +0 -55
- data/doc/ja/cairo-invalid-stride-error.html +0 -55
- data/doc/ja/cairo-invalid-string-error.html +0 -54
- data/doc/ja/cairo-invalid-visual-error.html +0 -57
- data/doc/ja/cairo-invalid-weight.html +0 -57
- data/doc/ja/cairo-line-cap.html +0 -50
- data/doc/ja/cairo-line-join.html +0 -53
- data/doc/ja/cairo-linear-pattern.html +0 -87
- data/doc/ja/cairo-matrix.html +0 -354
- data/doc/ja/cairo-negative-count.html +0 -52
- data/doc/ja/cairo-no-current-point-error.html +0 -54
- data/doc/ja/cairo-null-pointer-error.html +0 -54
- data/doc/ja/cairo-operator.html +0 -51
- data/doc/ja/cairo-paper-parse-error.html +0 -55
- data/doc/ja/cairo-paper-unknown-paper-name.html +0 -76
- data/doc/ja/cairo-paper-unknown-unit.html +0 -75
- data/doc/ja/cairo-paper-unrecognized-paper-description.html +0 -76
- data/doc/ja/cairo-paper.html +0 -357
- data/doc/ja/cairo-path-close-path.html +0 -57
- data/doc/ja/cairo-path-curve-to.html +0 -70
- data/doc/ja/cairo-path-data-type.html +0 -53
- data/doc/ja/cairo-path-data.html +0 -127
- data/doc/ja/cairo-path-line-to.html +0 -62
- data/doc/ja/cairo-path-move-to.html +0 -62
- data/doc/ja/cairo-path.html +0 -144
- data/doc/ja/cairo-pattern-type-mismatch-error.html +0 -56
- data/doc/ja/cairo-pattern.html +0 -128
- data/doc/ja/cairo-pdf-surface.html +0 -86
- data/doc/ja/cairo-point.html +0 -90
- data/doc/ja/cairo-ps-level.html +0 -62
- data/doc/ja/cairo-ps-surface.html +0 -214
- data/doc/ja/cairo-quartz-image-surface.html +0 -75
- data/doc/ja/cairo-quartz-surface.html +0 -93
- data/doc/ja/cairo-radial-pattern.html +0 -93
- data/doc/ja/cairo-read-error.html +0 -55
- data/doc/ja/cairo-rectangle.html +0 -109
- data/doc/ja/cairo-scaled-font.html +0 -180
- data/doc/ja/cairo-solid-pattern.html +0 -87
- data/doc/ja/cairo-subpixel-order.html +0 -57
- data/doc/ja/cairo-surface-finished-error.html +0 -54
- data/doc/ja/cairo-surface-pattern.html +0 -68
- data/doc/ja/cairo-surface-type-mismatch-error.html +0 -56
- data/doc/ja/cairo-surface.html +0 -213
- data/doc/ja/cairo-svg-surface.html +0 -114
- data/doc/ja/cairo-svg-version.html +0 -66
- data/doc/ja/cairo-temp-file-error.html +0 -50
- data/doc/ja/cairo-text-cluster-flag.html +0 -46
- data/doc/ja/cairo-text-cluster.html +0 -102
- data/doc/ja/cairo-text-extents.html +0 -163
- data/doc/ja/cairo-toy-font-face.html +0 -107
- data/doc/ja/cairo-user-font-error.html +0 -55
- data/doc/ja/cairo-user-font-face-text-to-glyphs-data.html +0 -156
- data/doc/ja/cairo-user-font-face.html +0 -268
- data/doc/ja/cairo-user-font-immutable.html +0 -54
- data/doc/ja/cairo-win32-printing-surface.html +0 -80
- data/doc/ja/cairo-win32-surface.html +0 -100
- data/doc/ja/cairo-write-error.html +0 -55
- data/doc/ja/cairo.html +0 -177
- data/doc/ja/index.html +0 -1156
- data/pkg-config.rb +0 -313
- data/test-unit/Rakefile +0 -30
- data/test-unit/bin/testrb +0 -5
- data/test-unit/lib/test/unit.rb +0 -280
- data/test-unit/lib/test/unit/assertionfailederror.rb +0 -14
- data/test-unit/lib/test/unit/assertions.rb +0 -722
- data/test-unit/lib/test/unit/attribute.rb +0 -125
- data/test-unit/lib/test/unit/autorunner.rb +0 -254
- data/test-unit/lib/test/unit/collector.rb +0 -43
- data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
- data/test-unit/lib/test/unit/collector/dir.rb +0 -108
- data/test-unit/lib/test/unit/collector/load.rb +0 -135
- data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
- data/test-unit/lib/test/unit/color.rb +0 -61
- data/test-unit/lib/test/unit/diff.rb +0 -524
- data/test-unit/lib/test/unit/error.rb +0 -124
- data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
- data/test-unit/lib/test/unit/failure.rb +0 -110
- data/test-unit/lib/test/unit/fixture.rb +0 -185
- data/test-unit/lib/test/unit/notification.rb +0 -125
- data/test-unit/lib/test/unit/omission.rb +0 -143
- data/test-unit/lib/test/unit/pending.rb +0 -146
- data/test-unit/lib/test/unit/priority.rb +0 -146
- data/test-unit/lib/test/unit/runner/console.rb +0 -46
- data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
- data/test-unit/lib/test/unit/testcase.rb +0 -281
- data/test-unit/lib/test/unit/testresult.rb +0 -89
- data/test-unit/lib/test/unit/testsuite.rb +0 -110
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -195
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -49
- data/test-unit/lib/test/unit/ui/testrunner.rb +0 -20
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
- data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -41
- data/test-unit/lib/test/unit/util/observable.rb +0 -90
- data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
- data/test-unit/lib/test/unit/version.rb +0 -7
- data/test-unit/sample/adder.rb +0 -13
- data/test-unit/sample/subtracter.rb +0 -12
- data/test-unit/sample/tc_adder.rb +0 -18
- data/test-unit/sample/tc_subtracter.rb +0 -18
- data/test-unit/sample/ts_examples.rb +0 -7
- data/test-unit/test/collector/test_descendant.rb +0 -135
- data/test-unit/test/collector/test_dir.rb +0 -406
- data/test-unit/test/collector/test_load.rb +0 -333
- data/test-unit/test/collector/test_objectspace.rb +0 -98
- data/test-unit/test/run-test.rb +0 -13
- data/test-unit/test/test_assertions.rb +0 -693
- data/test-unit/test/test_attribute.rb +0 -86
- data/test-unit/test/test_color.rb +0 -37
- data/test-unit/test/test_diff.rb +0 -477
- data/test-unit/test/test_emacs_runner.rb +0 -60
- data/test-unit/test/test_error.rb +0 -26
- data/test-unit/test/test_failure.rb +0 -33
- data/test-unit/test/test_fixture.rb +0 -252
- data/test-unit/test/test_notification.rb +0 -33
- data/test-unit/test/test_omission.rb +0 -81
- data/test-unit/test/test_pending.rb +0 -70
- data/test-unit/test/test_priority.rb +0 -89
- data/test-unit/test/test_testcase.rb +0 -430
- data/test-unit/test/test_testresult.rb +0 -113
- data/test-unit/test/test_testsuite.rb +0 -129
- data/test-unit/test/testunit_test_util.rb +0 -14
- data/test-unit/test/ui/test_testrunmediator.rb +0 -20
- data/test-unit/test/util/test_backtracefilter.rb +0 -41
- data/test-unit/test/util/test_observable.rb +0 -102
- data/test-unit/test/util/test_procwrapper.rb +0 -36
- data/test/test_pkg_config.rb +0 -123
- data/vendor/local/include/libpng14/png.h +0 -2701
- data/vendor/local/include/libpng14/pngconf.h +0 -1525
- data/vendor/local/include/png.h +0 -2701
- data/vendor/local/include/pngconf.h +0 -1525
- data/vendor/local/include/zconf.h +0 -461
- data/vendor/local/include/zlib.h +0 -1589
- data/vendor/local/lib/libpng.def +0 -192
- data/vendor/local/lib/libpng.lib +0 -0
- data/vendor/local/lib/libpng14.dll.a +0 -0
- data/vendor/local/lib/libz.dll.a +0 -0
- data/vendor/local/lib/pkgconfig/libpng.pc +0 -11
- data/vendor/local/lib/pkgconfig/libpng14.pc +0 -11
- data/vendor/local/lib/zdll.lib +0 -0
- data/vendor/local/lib/zlib.def +0 -67
- data/vendor/local/manifest/cairo_1.8.10-4_win32.mft +0 -5
- data/vendor/local/manifest/libpng-dev_1.4.3-1_win32.mft +0 -15
- data/vendor/local/manifest/zlib-dev_1.2.5-2_win32.mft +0 -8
- data/vendor/local/share/gtk-doc/html/cairo/cairo-context.html +0 -2643
- data/vendor/local/share/gtk-doc/html/cairo/cairo-error-status.html +0 -360
- data/vendor/local/share/gtk-doc/html/cairo/cairo-font-face.html +0 -408
- data/vendor/local/share/gtk-doc/html/cairo/cairo-font-options.html +0 -678
- data/vendor/local/share/gtk-doc/html/cairo/cairo-ft-font.html +0 -319
- data/vendor/local/share/gtk-doc/html/cairo/cairo-image-surface.html +0 -473
- data/vendor/local/share/gtk-doc/html/cairo/cairo-matrix.html +0 -596
- data/vendor/local/share/gtk-doc/html/cairo/cairo-paths.html +0 -1274
- data/vendor/local/share/gtk-doc/html/cairo/cairo-pattern.html +0 -1485
- data/vendor/local/share/gtk-doc/html/cairo/cairo-pdf-surface.html +0 -238
- data/vendor/local/share/gtk-doc/html/cairo/cairo-png-functions.html +0 -341
- data/vendor/local/share/gtk-doc/html/cairo/cairo-ps-surface.html +0 -622
- data/vendor/local/share/gtk-doc/html/cairo/cairo-quartz-font.html +0 -151
- data/vendor/local/share/gtk-doc/html/cairo/cairo-quartz-surface.html +0 -219
- data/vendor/local/share/gtk-doc/html/cairo/cairo-scaled-font.html +0 -1023
- data/vendor/local/share/gtk-doc/html/cairo/cairo-surface.html +0 -1026
- data/vendor/local/share/gtk-doc/html/cairo/cairo-svg-surface.html +0 -321
- data/vendor/local/share/gtk-doc/html/cairo/cairo-transformations.html +0 -436
- data/vendor/local/share/gtk-doc/html/cairo/cairo-types.html +0 -133
- data/vendor/local/share/gtk-doc/html/cairo/cairo-user-font.html +0 -735
- data/vendor/local/share/gtk-doc/html/cairo/cairo-version-info.html +0 -345
- data/vendor/local/share/gtk-doc/html/cairo/cairo-win32-font.html +0 -358
- data/vendor/local/share/gtk-doc/html/cairo/cairo-win32-surface.html +0 -312
- data/vendor/local/share/gtk-doc/html/cairo/cairo-xlib-surface.html +0 -492
- data/vendor/local/share/man/man3/libpng.3 +0 -4455
- data/vendor/local/share/man/man3/libpngpf.3 +0 -808
- data/vendor/local/share/man/man5/png.5 +0 -74
- data/vendor/local/src/tml/packaging/cairo_1.8.10-4_win32.log +0 -920
- data/vendor/local/src/tml/packaging/libpng_1.4.3-1_win32.log +0 -272
- data/vendor/local/src/tml/packaging/libpng_1.4.3-1_win32.sh +0 -71
- data/vendor/local/src/tml/packaging/zlib_1.2.5-2_win32.log +0 -42
- data/vendor/local/src/tml/packaging/zlib_1.2.5-2_win32.sh +0 -189
@@ -1,333 +0,0 @@
|
|
1
|
-
require 'tmpdir'
|
2
|
-
require 'pathname'
|
3
|
-
|
4
|
-
require 'test/unit'
|
5
|
-
require 'test/unit/collector/load'
|
6
|
-
|
7
|
-
class TestUnitCollectorLoad < Test::Unit::TestCase
|
8
|
-
def setup
|
9
|
-
@previous_descendants = Test::Unit::TestCase::DESCENDANTS.dup
|
10
|
-
Test::Unit::TestCase::DESCENDANTS.clear
|
11
|
-
|
12
|
-
@temporary_test_cases_module_name = "TempTestCases"
|
13
|
-
::Object.const_set(@temporary_test_cases_module_name, Module.new)
|
14
|
-
|
15
|
-
@test_dir = Pathname(Dir.tmpdir) + "test-unit"
|
16
|
-
@test_dir.rmtree if @test_dir.exist?
|
17
|
-
@test_dir.mkpath
|
18
|
-
end
|
19
|
-
|
20
|
-
setup
|
21
|
-
def setup_top_level_test_cases
|
22
|
-
@test_case1 = @test_dir + "test_case1.rb"
|
23
|
-
@test_case2 = @test_dir + "test_case2.rb"
|
24
|
-
@no_load_test_case3 = @test_dir + "case3.rb"
|
25
|
-
|
26
|
-
@test_case1.open("w") do |test_case|
|
27
|
-
test_case.puts(<<-EOT)
|
28
|
-
module #{@temporary_test_cases_module_name}
|
29
|
-
class TestCase1 < Test::Unit::TestCase
|
30
|
-
def test1_1
|
31
|
-
end
|
32
|
-
|
33
|
-
def test1_2
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
EOT
|
38
|
-
end
|
39
|
-
|
40
|
-
@test_case2.open("w") do |test_case|
|
41
|
-
test_case.puts(<<-EOT)
|
42
|
-
module #{@temporary_test_cases_module_name}
|
43
|
-
class TestCase2 < Test::Unit::TestCase
|
44
|
-
def test2
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
EOT
|
49
|
-
end
|
50
|
-
|
51
|
-
@no_load_test_case3.open("w") do |test_case|
|
52
|
-
test_case.puts(<<-EOT)
|
53
|
-
module #{@temporary_test_cases_module_name}
|
54
|
-
class NoLoadTestCase3 < Test::Unit::TestCase
|
55
|
-
def test3
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
EOT
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
setup
|
64
|
-
def setup_sub_level_test_cases
|
65
|
-
@sub_test_dir = @test_dir + "sub"
|
66
|
-
@sub_test_dir.mkpath
|
67
|
-
|
68
|
-
@sub_test_case4 = @sub_test_dir + "test_case4.rb"
|
69
|
-
@no_load_sub_test_case5 = @sub_test_dir + "case5.rb"
|
70
|
-
@sub_test_case6 = @sub_test_dir + "test_case6.rb"
|
71
|
-
|
72
|
-
@sub_test_case4.open("w") do |test_case|
|
73
|
-
test_case.puts(<<-EOT)
|
74
|
-
module #{@temporary_test_cases_module_name}
|
75
|
-
class SubTestCase4 < Test::Unit::TestCase
|
76
|
-
def test4_1
|
77
|
-
end
|
78
|
-
|
79
|
-
def test4_2
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
EOT
|
84
|
-
end
|
85
|
-
|
86
|
-
@no_load_sub_test_case5.open("w") do |test_case|
|
87
|
-
test_case.puts(<<-EOT)
|
88
|
-
module #{@temporary_test_cases_module_name}
|
89
|
-
class NoLoadSubTestCase5 < Test::Unit::TestCase
|
90
|
-
def test5_1
|
91
|
-
end
|
92
|
-
|
93
|
-
def test5_2
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
EOT
|
98
|
-
end
|
99
|
-
|
100
|
-
@sub_test_case6.open("w") do |test_case|
|
101
|
-
test_case.puts(<<-EOT)
|
102
|
-
module #{@temporary_test_cases_module_name}
|
103
|
-
class SubTestCase6 < Test::Unit::TestCase
|
104
|
-
def test6
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
EOT
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
setup
|
113
|
-
def setup_sub_level_test_cases2
|
114
|
-
@sub2_test_dir = @test_dir + "sub2"
|
115
|
-
@sub2_test_dir.mkpath
|
116
|
-
|
117
|
-
@no_load_sub2_test_case7 = @sub2_test_dir + "case7.rb"
|
118
|
-
@sub2_test_case8 = @sub2_test_dir + "test_case8.rb"
|
119
|
-
@sub2_test_case9 = @sub2_test_dir + "test_case9.rb"
|
120
|
-
|
121
|
-
@no_load_sub2_test_case7.open("w") do |test_case|
|
122
|
-
test_case.puts(<<-EOT)
|
123
|
-
module #{@temporary_test_cases_module_name}
|
124
|
-
class NoLoadSub2TestCase7 < Test::Unit::TestCase
|
125
|
-
def test7_1
|
126
|
-
end
|
127
|
-
|
128
|
-
def test7_2
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
EOT
|
133
|
-
end
|
134
|
-
|
135
|
-
@sub2_test_case8.open("w") do |test_case|
|
136
|
-
test_case.puts(<<-EOT)
|
137
|
-
module #{@temporary_test_cases_module_name}
|
138
|
-
class Sub2TestCase8 < Test::Unit::TestCase
|
139
|
-
def test8_1
|
140
|
-
end
|
141
|
-
|
142
|
-
def test8_2
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
EOT
|
147
|
-
end
|
148
|
-
|
149
|
-
@sub2_test_case9.open("w") do |test_case|
|
150
|
-
test_case.puts(<<-EOT)
|
151
|
-
module #{@temporary_test_cases_module_name}
|
152
|
-
class Sub2TestCase9 < Test::Unit::TestCase
|
153
|
-
def test9
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
EOT
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
setup
|
162
|
-
def setup_svn_test_cases
|
163
|
-
@svn_test_dir = @test_dir + ".svn"
|
164
|
-
@svn_test_dir.mkpath
|
165
|
-
|
166
|
-
@svn_test_case10 = @svn_test_dir + "test_case10.rb"
|
167
|
-
|
168
|
-
@svn_test_case10.open("w") do |test_case|
|
169
|
-
test_case.puts(<<-EOT)
|
170
|
-
module #{@temporary_test_cases_module_name}
|
171
|
-
class SvnTestCase10 < Test::Unit::TestCase
|
172
|
-
def test7
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
176
|
-
EOT
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
setup
|
181
|
-
def setup_sub_cvs_test_cases
|
182
|
-
@sub_cvs_test_dir = @sub_test_dir + "CVS"
|
183
|
-
@sub_cvs_test_dir.mkpath
|
184
|
-
|
185
|
-
@sub_cvs_test_case11 = @sub_cvs_test_dir + "test_case11.rb"
|
186
|
-
|
187
|
-
@sub_cvs_test_case11.open("w") do |test_case|
|
188
|
-
test_case.puts(<<-EOT)
|
189
|
-
module #{@temporary_test_cases_module_name}
|
190
|
-
class SubCVSTestCase11 < Test::Unit::TestCase
|
191
|
-
def test11
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
195
|
-
EOT
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
def teardown
|
200
|
-
@test_dir.rmtree if @test_dir.exist?
|
201
|
-
::Object.send(:remove_const, @temporary_test_cases_module_name)
|
202
|
-
Test::Unit::TestCase::DESCENDANTS.replace(@previous_descendants)
|
203
|
-
end
|
204
|
-
|
205
|
-
def test_simple_collect
|
206
|
-
assert_collect([:suite, {:name => @sub_test_dir.basename.to_s},
|
207
|
-
[:suite, {:name => _test_case_name("SubTestCase4")},
|
208
|
-
[:test, {:name => "test4_1"}],
|
209
|
-
[:test, {:name => "test4_2"}]],
|
210
|
-
[:suite, {:name => _test_case_name("SubTestCase6")},
|
211
|
-
[:test, {:name => "test6"}]]],
|
212
|
-
@sub_test_dir.to_s)
|
213
|
-
end
|
214
|
-
|
215
|
-
def test_multilevel_collect
|
216
|
-
assert_collect([:suite, {:name => "."},
|
217
|
-
[:suite, {:name => _test_case_name("TestCase1")},
|
218
|
-
[:test, {:name => "test1_1"}],
|
219
|
-
[:test, {:name => "test1_2"}]],
|
220
|
-
[:suite, {:name => _test_case_name("TestCase2")},
|
221
|
-
[:test, {:name => "test2"}]],
|
222
|
-
[:suite, {:name => @sub_test_dir.basename.to_s},
|
223
|
-
[:suite, {:name => _test_case_name("SubTestCase4")},
|
224
|
-
[:test, {:name => "test4_1"}],
|
225
|
-
[:test, {:name => "test4_2"}]],
|
226
|
-
[:suite, {:name => _test_case_name("SubTestCase6")},
|
227
|
-
[:test, {:name => "test6"}]]],
|
228
|
-
[:suite, {:name => @sub2_test_dir.basename.to_s},
|
229
|
-
[:suite, {:name => _test_case_name("Sub2TestCase8")},
|
230
|
-
[:test, {:name => "test8_1"}],
|
231
|
-
[:test, {:name => "test8_2"}]],
|
232
|
-
[:suite, {:name => _test_case_name("Sub2TestCase9")},
|
233
|
-
[:test, {:name => "test9"}]]]])
|
234
|
-
end
|
235
|
-
|
236
|
-
def test_collect_file
|
237
|
-
assert_collect([:suite, {:name => @test_case1.basename.to_s},
|
238
|
-
[:suite, {:name => _test_case_name("TestCase1")},
|
239
|
-
[:test, {:name => "test1_1"}],
|
240
|
-
[:test, {:name => "test1_2"}]]],
|
241
|
-
@test_case1.to_s)
|
242
|
-
|
243
|
-
assert_collect([:suite, {:name => @no_load_sub_test_case5.basename.to_s},
|
244
|
-
[:suite, {:name => _test_case_name("NoLoadSubTestCase5")},
|
245
|
-
[:test, {:name => "test5_1"}],
|
246
|
-
[:test, {:name => "test5_2"}]]],
|
247
|
-
@no_load_sub_test_case5.to_s)
|
248
|
-
end
|
249
|
-
|
250
|
-
def test_nil_pattern
|
251
|
-
assert_collect([:suite, {:name => @sub_test_dir.basename.to_s},
|
252
|
-
[:suite, {:name => _test_case_name("NoLoadSubTestCase5")},
|
253
|
-
[:test, {:name => "test5_1"}],
|
254
|
-
[:test, {:name => "test5_2"}]],
|
255
|
-
[:suite, {:name => _test_case_name("SubTestCase4")},
|
256
|
-
[:test, {:name => "test4_1"}],
|
257
|
-
[:test, {:name => "test4_2"}]],
|
258
|
-
[:suite, {:name => _test_case_name("SubTestCase6")},
|
259
|
-
[:test, {:name => "test6"}]]],
|
260
|
-
@sub_test_dir.to_s) do |collector|
|
261
|
-
collector.patterns.clear
|
262
|
-
end
|
263
|
-
end
|
264
|
-
|
265
|
-
def test_filtering
|
266
|
-
assert_collect([:suite, {:name => "."},
|
267
|
-
[:suite, {:name => _test_case_name("TestCase1")},
|
268
|
-
[:test, {:name => "test1_1"}],
|
269
|
-
[:test, {:name => "test1_2"}]]]) do |collector|
|
270
|
-
collector.filter = Proc.new do |test|
|
271
|
-
not /\Atest1/.match(test.method_name).nil?
|
272
|
-
end
|
273
|
-
end
|
274
|
-
end
|
275
|
-
|
276
|
-
def test_collect_multi
|
277
|
-
test_dirs = [@sub_test_dir.to_s, @sub2_test_dir.to_s]
|
278
|
-
assert_collect([:suite, {:name => "[#{test_dirs.join(', ')}]"},
|
279
|
-
[:suite, {:name => @sub_test_dir.basename.to_s},
|
280
|
-
[:suite, {:name => _test_case_name("SubTestCase4")},
|
281
|
-
[:test, {:name => "test4_1"}],
|
282
|
-
[:test, {:name => "test4_2"}]],
|
283
|
-
[:suite, {:name => _test_case_name("SubTestCase6")},
|
284
|
-
[:test, {:name => "test6"}]]],
|
285
|
-
[:suite, {:name => @sub2_test_dir.basename.to_s},
|
286
|
-
[:suite, {:name => _test_case_name("Sub2TestCase8")},
|
287
|
-
[:test, {:name => "test8_1"}],
|
288
|
-
[:test, {:name => "test8_2"}]],
|
289
|
-
[:suite, {:name => _test_case_name("Sub2TestCase9")},
|
290
|
-
[:test, {:name => "test9"}]]]],
|
291
|
-
*test_dirs)
|
292
|
-
end
|
293
|
-
|
294
|
-
private
|
295
|
-
def assert_collect(expected, *collect_args)
|
296
|
-
keep_required_files do
|
297
|
-
Dir.chdir(@test_dir.to_s) do
|
298
|
-
collector = Test::Unit::Collector::Load.new
|
299
|
-
yield(collector) if block_given?
|
300
|
-
actual = inspect_test_object(collector.send(:collect, *collect_args))
|
301
|
-
assert_equal(expected, actual)
|
302
|
-
end
|
303
|
-
end
|
304
|
-
end
|
305
|
-
|
306
|
-
def keep_required_files
|
307
|
-
required_files = $".dup
|
308
|
-
yield
|
309
|
-
ensure
|
310
|
-
$".replace(required_files)
|
311
|
-
end
|
312
|
-
|
313
|
-
def _test_case_name(test_case_class_name)
|
314
|
-
"#{@temporary_test_cases_module_name}::#{test_case_class_name}"
|
315
|
-
end
|
316
|
-
|
317
|
-
def inspect_test_object(test_object)
|
318
|
-
return nil if test_object.nil?
|
319
|
-
case test_object
|
320
|
-
when Test::Unit::TestSuite
|
321
|
-
sub_tests = test_object.tests.collect do |test|
|
322
|
-
inspect_test_object(test)
|
323
|
-
end.sort_by do |type, attributes, *children|
|
324
|
-
attributes[:name]
|
325
|
-
end
|
326
|
-
[:suite, {:name => test_object.name}, *sub_tests]
|
327
|
-
when Test::Unit::TestCase
|
328
|
-
[:test, {:name => test_object.method_name}]
|
329
|
-
else
|
330
|
-
raise "unexpected test object: #{test_object.inspect}"
|
331
|
-
end
|
332
|
-
end
|
333
|
-
end
|
@@ -1,98 +0,0 @@
|
|
1
|
-
# Author:: Nathaniel Talbott.
|
2
|
-
# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved.
|
3
|
-
# License:: Ruby license.
|
4
|
-
|
5
|
-
require 'test/unit'
|
6
|
-
require 'test/unit/collector/objectspace'
|
7
|
-
|
8
|
-
module Test
|
9
|
-
module Unit
|
10
|
-
module Collector
|
11
|
-
class TC_ObjectSpace < TestCase
|
12
|
-
def setup
|
13
|
-
@tc1 = Class.new(TestCase) do
|
14
|
-
def self.name
|
15
|
-
"tc_1"
|
16
|
-
end
|
17
|
-
def test_1
|
18
|
-
end
|
19
|
-
def test_2
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
@tc2 = Class.new(TestCase) do
|
24
|
-
def self.name
|
25
|
-
"tc_2"
|
26
|
-
end
|
27
|
-
def test_0
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
@no_tc = Class.new do
|
32
|
-
def test_4
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
@object_space = {Class => [@tc1, @tc2, @no_tc], String => ['']}
|
37
|
-
def @object_space.each_object(type)
|
38
|
-
self[type].each{|item| yield(item) }
|
39
|
-
end
|
40
|
-
|
41
|
-
@c = ObjectSpace.new(@object_space)
|
42
|
-
end
|
43
|
-
|
44
|
-
def full_suite(name=ObjectSpace::NAME)
|
45
|
-
expected = TestSuite.new(name)
|
46
|
-
expected << (TestSuite.new(@tc1.name) << @tc1.new('test_1') << @tc1.new('test_2'))
|
47
|
-
expected << (TestSuite.new(@tc2.name) << @tc2.new('test_0'))
|
48
|
-
end
|
49
|
-
|
50
|
-
def empty_suite
|
51
|
-
TestSuite.new(ObjectSpace::NAME)
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_basic_collection
|
55
|
-
assert_equal(full_suite("name"), @c.collect("name"))
|
56
|
-
|
57
|
-
@c.filter = []
|
58
|
-
assert_equal(full_suite("name"), @c.collect("name"))
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_filtered_collection
|
62
|
-
@c.filter = proc{false}
|
63
|
-
assert_equal(empty_suite, @c.collect)
|
64
|
-
|
65
|
-
@c.filter = proc{true}
|
66
|
-
assert_equal(full_suite, @c.collect)
|
67
|
-
|
68
|
-
@c.filter = proc{nil}
|
69
|
-
assert_equal(full_suite, @c.collect)
|
70
|
-
|
71
|
-
@c.filter = [proc{false}, proc{true}]
|
72
|
-
assert_equal(empty_suite, @c.collect)
|
73
|
-
|
74
|
-
@c.filter = [proc{true}, proc{false}]
|
75
|
-
assert_equal(full_suite, @c.collect)
|
76
|
-
|
77
|
-
@c.filter = [proc{nil}, proc{false}]
|
78
|
-
assert_equal(empty_suite, @c.collect)
|
79
|
-
|
80
|
-
@c.filter = [proc{nil}, proc{true}]
|
81
|
-
assert_equal(full_suite, @c.collect)
|
82
|
-
|
83
|
-
expected = TestSuite.new(ObjectSpace::NAME)
|
84
|
-
expected << (TestSuite.new(@tc1.name) << @tc1.new('test_1'))
|
85
|
-
expected << (TestSuite.new(@tc2.name) << @tc2.new('test_0'))
|
86
|
-
@c.filter = proc{|test| ['test_1', 'test_0'].include?(test.method_name)}
|
87
|
-
assert_equal(expected, @c.collect)
|
88
|
-
|
89
|
-
expected = TestSuite.new(ObjectSpace::NAME)
|
90
|
-
expected << (TestSuite.new(@tc1.name) << @tc1.new('test_1'))
|
91
|
-
expected << (TestSuite.new(@tc2.name) << @tc2.new('test_0'))
|
92
|
-
@c.filter = [proc{|t| t.method_name == 'test_1' ? true : nil}, proc{|t| t.method_name == 'test_0' ? true : nil}, proc{false}]
|
93
|
-
assert_equal(expected, @c.collect)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
data/test-unit/test/run-test.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$VERBOSE = true
|
4
|
-
|
5
|
-
base_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
6
|
-
lib_dir = File.join(base_dir, "lib")
|
7
|
-
test_dir = File.join(base_dir, "test")
|
8
|
-
|
9
|
-
$LOAD_PATH.unshift(lib_dir)
|
10
|
-
|
11
|
-
require 'test/unit'
|
12
|
-
|
13
|
-
exit Test::Unit::AutoRunner.run(true, test_dir)
|
@@ -1,693 +0,0 @@
|
|
1
|
-
# Author:: Nathaniel Talbott.
|
2
|
-
# Copyright:: Copyright (c) 2000-2002 Nathaniel Talbott. All rights reserved.
|
3
|
-
# License:: Ruby license.
|
4
|
-
|
5
|
-
require 'test/unit'
|
6
|
-
|
7
|
-
module Test
|
8
|
-
module Unit
|
9
|
-
class TC_Assertions < TestCase
|
10
|
-
def check(value, message="")
|
11
|
-
add_assertion
|
12
|
-
raise AssertionFailedError.new(message) unless value
|
13
|
-
end
|
14
|
-
|
15
|
-
def check_assertions(expect_fail, expected_message="",
|
16
|
-
return_value_expected=false)
|
17
|
-
@actual_assertion_count = 0
|
18
|
-
failed = true
|
19
|
-
actual_message = nil
|
20
|
-
@catch_assertions = true
|
21
|
-
return_value = nil
|
22
|
-
begin
|
23
|
-
return_value = yield
|
24
|
-
failed = false
|
25
|
-
rescue AssertionFailedError => error
|
26
|
-
actual_message = error.message
|
27
|
-
end
|
28
|
-
@catch_assertions = false
|
29
|
-
|
30
|
-
if expect_fail
|
31
|
-
message = "Should have failed, but didn't"
|
32
|
-
else
|
33
|
-
message = "Should not have failed, but did with message\n" +
|
34
|
-
"<#{actual_message}>"
|
35
|
-
end
|
36
|
-
check(expect_fail == failed, message)
|
37
|
-
|
38
|
-
message = "Should have made one assertion but made\n" +
|
39
|
-
"<#{@actual_assertion_count}>"
|
40
|
-
check(1 == @actual_assertion_count, message)
|
41
|
-
|
42
|
-
if expect_fail
|
43
|
-
case expected_message
|
44
|
-
when String
|
45
|
-
check(actual_message == expected_message,
|
46
|
-
"Should have the correct message.\n" +
|
47
|
-
"<#{expected_message.inspect}> expected but was\n" +
|
48
|
-
"<#{actual_message.inspect}>")
|
49
|
-
when Regexp
|
50
|
-
check(actual_message =~ expected_message,
|
51
|
-
"The message should match correctly.\n" +
|
52
|
-
"</#{expected_message.source}/> expected to match\n" +
|
53
|
-
"<#{actual_message.inspect}>")
|
54
|
-
else
|
55
|
-
check(false,
|
56
|
-
"Incorrect expected message type in assert_nothing_failed")
|
57
|
-
end
|
58
|
-
else
|
59
|
-
if return_value_expected
|
60
|
-
check(!return_value.nil?, "Should return a value")
|
61
|
-
else
|
62
|
-
check(return_value.nil?,
|
63
|
-
"Should not return a value but returned <#{return_value}>")
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
return_value
|
68
|
-
end
|
69
|
-
|
70
|
-
def check_nothing_fails(return_value_expected=false, &proc)
|
71
|
-
check_assertions(false, "", return_value_expected, &proc)
|
72
|
-
end
|
73
|
-
|
74
|
-
def check_fails(expected_message="", &proc)
|
75
|
-
check_assertions(true, expected_message, &proc)
|
76
|
-
end
|
77
|
-
|
78
|
-
def inspect_tag(tag)
|
79
|
-
begin
|
80
|
-
throw tag
|
81
|
-
rescue NameError
|
82
|
-
tag.to_s.inspect
|
83
|
-
rescue ArgumentError
|
84
|
-
tag.inspect
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_assert_block
|
89
|
-
check_nothing_fails {
|
90
|
-
assert_block {true}
|
91
|
-
}
|
92
|
-
check_nothing_fails {
|
93
|
-
assert_block("successful assert_block") {true}
|
94
|
-
}
|
95
|
-
check_nothing_fails {
|
96
|
-
assert_block("successful assert_block") {true}
|
97
|
-
}
|
98
|
-
check_fails("assert_block failed.") {
|
99
|
-
assert_block {false}
|
100
|
-
}
|
101
|
-
check_fails("failed assert_block") {
|
102
|
-
assert_block("failed assert_block") {false}
|
103
|
-
}
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_assert
|
107
|
-
check_nothing_fails{assert("a")}
|
108
|
-
check_nothing_fails{assert(true)}
|
109
|
-
check_nothing_fails{assert(true, "successful assert")}
|
110
|
-
check_fails("<nil> is not true."){assert(nil)}
|
111
|
-
check_fails("<false> is not true."){assert(false)}
|
112
|
-
check_fails("failed assert.\n<false> is not true."){assert(false, "failed assert")}
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_assert_equal
|
116
|
-
check_nothing_fails {
|
117
|
-
assert_equal("string1", "string1")
|
118
|
-
}
|
119
|
-
check_nothing_fails {
|
120
|
-
assert_equal( "string1", "string1", "successful assert_equal")
|
121
|
-
}
|
122
|
-
check_nothing_fails {
|
123
|
-
assert_equal("string1", "string1", "successful assert_equal")
|
124
|
-
}
|
125
|
-
|
126
|
-
message = <<-EOM.chomp
|
127
|
-
<"string1"> expected but was
|
128
|
-
<"string2">.
|
129
|
-
|
130
|
-
diff:
|
131
|
-
- string1
|
132
|
-
? ^
|
133
|
-
+ string2
|
134
|
-
? ^
|
135
|
-
EOM
|
136
|
-
check_fails(message) {
|
137
|
-
assert_equal("string1", "string2")
|
138
|
-
}
|
139
|
-
|
140
|
-
message = <<-EOM.chomp
|
141
|
-
failed assert_equal.
|
142
|
-
<"string1"> expected but was
|
143
|
-
<"string2">.
|
144
|
-
|
145
|
-
diff:
|
146
|
-
- string1
|
147
|
-
? ^
|
148
|
-
+ string2
|
149
|
-
? ^
|
150
|
-
EOM
|
151
|
-
check_fails(message) {
|
152
|
-
assert_equal("string1", "string2", "failed assert_equal")
|
153
|
-
}
|
154
|
-
|
155
|
-
message = <<-EOM.chomp
|
156
|
-
<"111111"> expected but was
|
157
|
-
<111111>.
|
158
|
-
|
159
|
-
diff:
|
160
|
-
- "111111"
|
161
|
-
? - -
|
162
|
-
+ 111111
|
163
|
-
EOM
|
164
|
-
check_fails(message) do
|
165
|
-
assert_equal("111111", 111111)
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
def test_assert_equal_for_too_small_difference
|
170
|
-
message = <<-EOM.chomp
|
171
|
-
<1> expected but was
|
172
|
-
<2>.
|
173
|
-
EOM
|
174
|
-
check_fails(message) do
|
175
|
-
assert_equal(1, 2)
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
def test_assert_equal_for_same_inspected_objects
|
180
|
-
now = Time.now
|
181
|
-
now_without_usec = Time.at(now.to_i)
|
182
|
-
message = <<-EOM.chomp
|
183
|
-
<#{now.inspect}> expected but was
|
184
|
-
<#{now.inspect}>.
|
185
|
-
EOM
|
186
|
-
check_fails(message) do
|
187
|
-
assert_equal(now, now_without_usec)
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
def test_assert_equal_with_multi_lines_result
|
192
|
-
message = <<-EOM.chomp
|
193
|
-
<#{"a\nb".inspect}> expected but was
|
194
|
-
<#{"x".inspect}>.
|
195
|
-
|
196
|
-
diff:
|
197
|
-
+ x
|
198
|
-
- a
|
199
|
-
- b
|
200
|
-
EOM
|
201
|
-
check_fails(message) do
|
202
|
-
assert_equal("a\nb", "x")
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
def test_assert_raise
|
207
|
-
return_value = nil
|
208
|
-
check_nothing_fails(true) {
|
209
|
-
return_value = assert_raise(RuntimeError) {
|
210
|
-
raise "Error"
|
211
|
-
}
|
212
|
-
}
|
213
|
-
check(return_value.kind_of?(Exception), "Should have returned the exception from a successful assert_raise")
|
214
|
-
check(return_value.message == "Error", "Should have returned the correct exception from a successful assert_raise")
|
215
|
-
check_nothing_fails(true) {
|
216
|
-
assert_raise(ArgumentError, "successful assert_raise") {
|
217
|
-
raise ArgumentError.new("Error")
|
218
|
-
}
|
219
|
-
}
|
220
|
-
check_nothing_fails(true) {
|
221
|
-
assert_raise(RuntimeError) {
|
222
|
-
raise "Error"
|
223
|
-
}
|
224
|
-
}
|
225
|
-
check_nothing_fails(true) {
|
226
|
-
assert_raise(RuntimeError, "successful assert_raise") {
|
227
|
-
raise "Error"
|
228
|
-
}
|
229
|
-
}
|
230
|
-
check_fails("<RuntimeError> exception expected but none was thrown.") {
|
231
|
-
assert_raise(RuntimeError) {
|
232
|
-
1 + 1
|
233
|
-
}
|
234
|
-
}
|
235
|
-
check_fails(%r{\Afailed assert_raise.\n<ArgumentError> exception expected but was\nClass: <RuntimeError>\nMessage: <"Error">\n---Backtrace---\n.+\n---------------\Z}m) {
|
236
|
-
assert_raise(ArgumentError, "failed assert_raise") {
|
237
|
-
raise "Error"
|
238
|
-
}
|
239
|
-
}
|
240
|
-
check_fails("Should expect a class of exception, Object.\n<false> is not true.") {
|
241
|
-
assert_nothing_raised(Object) {
|
242
|
-
1 + 1
|
243
|
-
}
|
244
|
-
}
|
245
|
-
|
246
|
-
exceptions = [ArgumentError, TypeError]
|
247
|
-
modules = [Math, Comparable]
|
248
|
-
rescues = exceptions + modules
|
249
|
-
exceptions.each do |exc|
|
250
|
-
check_nothing_fails(true) {
|
251
|
-
return_value = assert_raise(*rescues) {
|
252
|
-
raise exc, "Error"
|
253
|
-
}
|
254
|
-
}
|
255
|
-
check(return_value.instance_of?(exc), "Should have returned #{exc} but was #{return_value.class}")
|
256
|
-
check(return_value.message == "Error", "Should have returned the correct exception from a successful assert_raise")
|
257
|
-
end
|
258
|
-
modules.each do |mod|
|
259
|
-
check_nothing_fails(true) {
|
260
|
-
return_value = assert_raise(*rescues) {
|
261
|
-
raise Exception.new("Error").extend(mod)
|
262
|
-
}
|
263
|
-
}
|
264
|
-
check(mod === return_value, "Should have returned #{mod}")
|
265
|
-
check(return_value.message == "Error", "Should have returned the correct exception from a successful assert_raise")
|
266
|
-
end
|
267
|
-
check_fails("<[ArgumentError, TypeError, Math, Comparable]> exception expected but none was thrown.") {
|
268
|
-
assert_raise(*rescues) {
|
269
|
-
1 + 1
|
270
|
-
}
|
271
|
-
}
|
272
|
-
check_fails(%r{\Afailed assert_raise.
|
273
|
-
<\[ArgumentError, TypeError\]> exception expected but was
|
274
|
-
Class: <RuntimeError>
|
275
|
-
Message: <"Error">
|
276
|
-
---Backtrace---
|
277
|
-
.+
|
278
|
-
---------------\Z}m) {
|
279
|
-
assert_raise(ArgumentError, TypeError, "failed assert_raise") {
|
280
|
-
raise "Error"
|
281
|
-
}
|
282
|
-
}
|
283
|
-
end
|
284
|
-
|
285
|
-
def test_assert_instance_of
|
286
|
-
check_nothing_fails {
|
287
|
-
assert_instance_of(String, "string")
|
288
|
-
}
|
289
|
-
check_nothing_fails {
|
290
|
-
assert_instance_of(String, "string", "successful assert_instance_of")
|
291
|
-
}
|
292
|
-
check_nothing_fails {
|
293
|
-
assert_instance_of(String, "string", "successful assert_instance_of")
|
294
|
-
}
|
295
|
-
check_fails(%Q{<"string"> expected to be an instance of\n<Hash> but was\n<String>.}) {
|
296
|
-
assert_instance_of(Hash, "string")
|
297
|
-
}
|
298
|
-
check_fails(%Q{failed assert_instance_of.\n<"string"> expected to be an instance of\n<Hash> but was\n<String>.}) {
|
299
|
-
assert_instance_of(Hash, "string", "failed assert_instance_of")
|
300
|
-
}
|
301
|
-
end
|
302
|
-
|
303
|
-
def test_assert_nil
|
304
|
-
check_nothing_fails {
|
305
|
-
assert_nil(nil)
|
306
|
-
}
|
307
|
-
check_nothing_fails {
|
308
|
-
assert_nil(nil, "successful assert_nil")
|
309
|
-
}
|
310
|
-
check_nothing_fails {
|
311
|
-
assert_nil(nil, "successful assert_nil")
|
312
|
-
}
|
313
|
-
check_fails(%Q{<"string"> expected to be nil.}) {
|
314
|
-
assert_nil("string")
|
315
|
-
}
|
316
|
-
check_fails(%Q{failed assert_nil.\n<"string"> expected to be nil.}) {
|
317
|
-
assert_nil("string", "failed assert_nil")
|
318
|
-
}
|
319
|
-
end
|
320
|
-
|
321
|
-
def test_assert_not_nil
|
322
|
-
check_nothing_fails{assert_not_nil(false)}
|
323
|
-
check_nothing_fails{assert_not_nil(false, "message")}
|
324
|
-
check_fails("<nil> expected to not be nil."){assert_not_nil(nil)}
|
325
|
-
check_fails("message.\n<nil> expected to not be nil.") {assert_not_nil(nil, "message")}
|
326
|
-
end
|
327
|
-
|
328
|
-
def test_assert_kind_of
|
329
|
-
check_nothing_fails {
|
330
|
-
assert_kind_of(Module, Array)
|
331
|
-
}
|
332
|
-
check_nothing_fails {
|
333
|
-
assert_kind_of(Object, "string", "successful assert_kind_of")
|
334
|
-
}
|
335
|
-
check_nothing_fails {
|
336
|
-
assert_kind_of(Object, "string", "successful assert_kind_of")
|
337
|
-
}
|
338
|
-
check_nothing_fails {
|
339
|
-
assert_kind_of(Comparable, 1)
|
340
|
-
}
|
341
|
-
check_fails(%Q{<"string">\nexpected to be kind_of?\n<Class> but was\n<String>.}) {
|
342
|
-
assert_kind_of(Class, "string")
|
343
|
-
}
|
344
|
-
check_fails(%Q{failed assert_kind_of.\n<"string">\nexpected to be kind_of?\n<Class> but was\n<String>.}) {
|
345
|
-
assert_kind_of(Class, "string", "failed assert_kind_of")
|
346
|
-
}
|
347
|
-
end
|
348
|
-
|
349
|
-
def test_assert_match
|
350
|
-
check_nothing_fails {
|
351
|
-
assert_match(/strin./, "string")
|
352
|
-
}
|
353
|
-
check_nothing_fails {
|
354
|
-
assert_match("strin", "string")
|
355
|
-
}
|
356
|
-
check_nothing_fails {
|
357
|
-
assert_match(/strin./, "string", "successful assert_match")
|
358
|
-
}
|
359
|
-
check_nothing_fails {
|
360
|
-
assert_match(/strin./, "string", "successful assert_match")
|
361
|
-
}
|
362
|
-
check_fails(%Q{<"string"> expected to be =~\n</slin./>.}) {
|
363
|
-
assert_match(/slin./, "string")
|
364
|
-
}
|
365
|
-
check_fails(%Q{<"string"> expected to be =~\n</strin\\./>.}) {
|
366
|
-
assert_match("strin.", "string")
|
367
|
-
}
|
368
|
-
check_fails(%Q{failed assert_match.\n<"string"> expected to be =~\n</slin./>.}) {
|
369
|
-
assert_match(/slin./, "string", "failed assert_match")
|
370
|
-
}
|
371
|
-
end
|
372
|
-
|
373
|
-
def test_assert_same
|
374
|
-
thing = "thing"
|
375
|
-
check_nothing_fails {
|
376
|
-
assert_same(thing, thing)
|
377
|
-
}
|
378
|
-
check_nothing_fails {
|
379
|
-
assert_same(thing, thing, "successful assert_same")
|
380
|
-
}
|
381
|
-
check_nothing_fails {
|
382
|
-
assert_same(thing, thing, "successful assert_same")
|
383
|
-
}
|
384
|
-
thing2 = "thing"
|
385
|
-
check_fails(%Q{<"thing">\nwith id <#{thing.__id__}> expected to be equal? to\n<"thing">\nwith id <#{thing2.__id__}>.}) {
|
386
|
-
assert_same(thing, thing2)
|
387
|
-
}
|
388
|
-
check_fails(%Q{failed assert_same.\n<"thing">\nwith id <#{thing.__id__}> expected to be equal? to\n<"thing">\nwith id <#{thing2.__id__}>.}) {
|
389
|
-
assert_same(thing, thing2, "failed assert_same")
|
390
|
-
}
|
391
|
-
end
|
392
|
-
|
393
|
-
def test_assert_nothing_raised
|
394
|
-
check_nothing_fails {
|
395
|
-
assert_nothing_raised {
|
396
|
-
1 + 1
|
397
|
-
}
|
398
|
-
}
|
399
|
-
check_nothing_fails {
|
400
|
-
assert_nothing_raised("successful assert_nothing_raised") {
|
401
|
-
1 + 1
|
402
|
-
}
|
403
|
-
}
|
404
|
-
check_nothing_fails {
|
405
|
-
assert_nothing_raised("successful assert_nothing_raised") {
|
406
|
-
1 + 1
|
407
|
-
}
|
408
|
-
}
|
409
|
-
check_nothing_fails {
|
410
|
-
begin
|
411
|
-
assert_nothing_raised(RuntimeError, StandardError, Comparable, "successful assert_nothing_raised") {
|
412
|
-
raise ZeroDivisionError.new("ArgumentError")
|
413
|
-
}
|
414
|
-
rescue ZeroDivisionError
|
415
|
-
end
|
416
|
-
}
|
417
|
-
check_fails("Should expect a class of exception, Object.\n<false> is not true.") {
|
418
|
-
assert_nothing_raised(Object) {
|
419
|
-
1 + 1
|
420
|
-
}
|
421
|
-
}
|
422
|
-
check_fails(%r{\AException raised:\nClass: <RuntimeError>\nMessage: <"Error">\n---Backtrace---\n.+\n---------------\Z}m) {
|
423
|
-
assert_nothing_raised {
|
424
|
-
raise "Error"
|
425
|
-
}
|
426
|
-
}
|
427
|
-
check_fails(%r{\Afailed assert_nothing_raised\.\nException raised:\nClass: <RuntimeError>\nMessage: <"Error">\n---Backtrace---\n.+\n---------------\Z}m) {
|
428
|
-
assert_nothing_raised("failed assert_nothing_raised") {
|
429
|
-
raise "Error"
|
430
|
-
}
|
431
|
-
}
|
432
|
-
check_fails(%r{\AException raised:\nClass: <RuntimeError>\nMessage: <"Error">\n---Backtrace---\n.+\n---------------\Z}m) {
|
433
|
-
assert_nothing_raised(StandardError, RuntimeError) {
|
434
|
-
raise "Error"
|
435
|
-
}
|
436
|
-
}
|
437
|
-
check_fails("Failure.") do
|
438
|
-
assert_nothing_raised do
|
439
|
-
flunk("Failure")
|
440
|
-
end
|
441
|
-
end
|
442
|
-
end
|
443
|
-
|
444
|
-
def test_flunk
|
445
|
-
check_fails("Flunked.") {
|
446
|
-
flunk
|
447
|
-
}
|
448
|
-
check_fails("flunk message.") {
|
449
|
-
flunk("flunk message")
|
450
|
-
}
|
451
|
-
end
|
452
|
-
|
453
|
-
def test_assert_not_same
|
454
|
-
thing = "thing"
|
455
|
-
thing2 = "thing"
|
456
|
-
check_nothing_fails {
|
457
|
-
assert_not_same(thing, thing2)
|
458
|
-
}
|
459
|
-
check_nothing_fails {
|
460
|
-
assert_not_same(thing, thing2, "message")
|
461
|
-
}
|
462
|
-
check_fails(%Q{<"thing">\nwith id <#{thing.__id__}> expected to not be equal? to\n<"thing">\nwith id <#{thing.__id__}>.}) {
|
463
|
-
assert_not_same(thing, thing)
|
464
|
-
}
|
465
|
-
check_fails(%Q{message.\n<"thing">\nwith id <#{thing.__id__}> expected to not be equal? to\n<"thing">\nwith id <#{thing.__id__}>.}) {
|
466
|
-
assert_not_same(thing, thing, "message")
|
467
|
-
}
|
468
|
-
end
|
469
|
-
|
470
|
-
def test_assert_not_equal
|
471
|
-
check_nothing_fails {
|
472
|
-
assert_not_equal("string1", "string2")
|
473
|
-
}
|
474
|
-
check_nothing_fails {
|
475
|
-
assert_not_equal("string1", "string2", "message")
|
476
|
-
}
|
477
|
-
check_fails(%Q{<"string"> expected to be != to\n<"string">.}) {
|
478
|
-
assert_not_equal("string", "string")
|
479
|
-
}
|
480
|
-
check_fails(%Q{message.\n<"string"> expected to be != to\n<"string">.}) {
|
481
|
-
assert_not_equal("string", "string", "message")
|
482
|
-
}
|
483
|
-
end
|
484
|
-
|
485
|
-
def test_assert_no_match
|
486
|
-
check_nothing_fails{assert_no_match(/sling/, "string")}
|
487
|
-
check_nothing_fails{assert_no_match(/sling/, "string", "message")}
|
488
|
-
check_fails(%Q{The first argument to assert_no_match should be a Regexp.\n<"asdf"> expected to be an instance of\n<Regexp> but was\n<String>.}) do
|
489
|
-
assert_no_match("asdf", "asdf")
|
490
|
-
end
|
491
|
-
check_fails(%Q{</string/> expected to not match\n<"string">.}) do
|
492
|
-
assert_no_match(/string/, "string")
|
493
|
-
end
|
494
|
-
check_fails(%Q{message.\n</string/> expected to not match\n<"string">.}) do
|
495
|
-
assert_no_match(/string/, "string", "message")
|
496
|
-
end
|
497
|
-
end
|
498
|
-
|
499
|
-
def test_assert_throws
|
500
|
-
check_nothing_fails do
|
501
|
-
assert_throws(:thing, "message") do
|
502
|
-
throw :thing
|
503
|
-
end
|
504
|
-
end
|
505
|
-
|
506
|
-
tag = :thing2
|
507
|
-
check_fails("message.\n" +
|
508
|
-
"<:thing> expected to be thrown but\n" +
|
509
|
-
"<#{inspect_tag(tag)}> was thrown.") do
|
510
|
-
assert_throws(:thing, "message") do
|
511
|
-
throw :thing2
|
512
|
-
end
|
513
|
-
end
|
514
|
-
check_fails("message.\n" +
|
515
|
-
"<:thing> should have been thrown.") do
|
516
|
-
assert_throws(:thing, "message") do
|
517
|
-
1 + 1
|
518
|
-
end
|
519
|
-
end
|
520
|
-
end
|
521
|
-
|
522
|
-
def test_assert_nothing_thrown
|
523
|
-
check_nothing_fails do
|
524
|
-
assert_nothing_thrown("message") do
|
525
|
-
1 + 1
|
526
|
-
end
|
527
|
-
end
|
528
|
-
|
529
|
-
tag = :thing
|
530
|
-
inspected = inspect_tag(tag)
|
531
|
-
check_fails("message.\n" +
|
532
|
-
"<#{inspected}> was thrown when nothing was expected.") do
|
533
|
-
assert_nothing_thrown("message") do
|
534
|
-
throw tag
|
535
|
-
end
|
536
|
-
end
|
537
|
-
end
|
538
|
-
|
539
|
-
def test_assert_operator
|
540
|
-
check_nothing_fails {
|
541
|
-
assert_operator("thing", :==, "thing", "message")
|
542
|
-
}
|
543
|
-
check_fails(%Q{<0.15>\ngiven as the operator for #assert_operator must be a Symbol or #respond_to?(:to_str).}) do
|
544
|
-
assert_operator("thing", 0.15, "thing")
|
545
|
-
end
|
546
|
-
check_fails(%Q{message.\n<"thing1"> expected to be\n==\n<"thing2">.}) {
|
547
|
-
assert_operator("thing1", :==, "thing2", "message")
|
548
|
-
}
|
549
|
-
end
|
550
|
-
|
551
|
-
def test_assert_respond_to
|
552
|
-
check_nothing_fails {
|
553
|
-
assert_respond_to("thing", :to_s, "message")
|
554
|
-
}
|
555
|
-
check_nothing_fails {
|
556
|
-
assert_respond_to("thing", "to_s", "message")
|
557
|
-
}
|
558
|
-
check_fails("<0.15>\ngiven as the method name argument to #assert_respond_to must be a Symbol or #respond_to?(:to_str).") {
|
559
|
-
assert_respond_to("thing", 0.15)
|
560
|
-
}
|
561
|
-
check_fails("message.\n<:symbol>\nof type <Symbol>\nexpected to respond_to?<:non_existent>.") {
|
562
|
-
assert_respond_to(:symbol, :non_existent, "message")
|
563
|
-
}
|
564
|
-
end
|
565
|
-
|
566
|
-
def test_assert_in_delta
|
567
|
-
check_nothing_fails {
|
568
|
-
assert_in_delta(1.4, 1.4, 0)
|
569
|
-
}
|
570
|
-
check_nothing_fails {
|
571
|
-
assert_in_delta(0.5, 0.4, 0.1, "message")
|
572
|
-
}
|
573
|
-
check_nothing_fails {
|
574
|
-
float_thing = Object.new
|
575
|
-
def float_thing.to_f
|
576
|
-
0.2
|
577
|
-
end
|
578
|
-
assert_in_delta(0.1, float_thing, 0.1)
|
579
|
-
}
|
580
|
-
check_fails("message.\n<0.5> and\n<0.4> expected to be within\n<0.05> of each other.") {
|
581
|
-
assert_in_delta(0.5, 0.4, 0.05, "message")
|
582
|
-
}
|
583
|
-
check_fails(%r{The arguments must respond to to_f; the first float did not\.\n<.+>\nof type <Object>\nexpected to respond_to\?<:to_f>.}) {
|
584
|
-
assert_in_delta(Object.new, 0.4, 0.1)
|
585
|
-
}
|
586
|
-
check_fails("The delta should not be negative.\n<-0.1> expected to be\n>=\n<0.0>.") {
|
587
|
-
assert_in_delta(0.5, 0.4, -0.1, "message")
|
588
|
-
}
|
589
|
-
end
|
590
|
-
|
591
|
-
def test_assert_send
|
592
|
-
object = Object.new
|
593
|
-
class << object
|
594
|
-
private
|
595
|
-
def return_argument(argument, bogus)
|
596
|
-
return argument
|
597
|
-
end
|
598
|
-
end
|
599
|
-
check_nothing_fails {
|
600
|
-
assert_send([object, :return_argument, true, "bogus"], "message")
|
601
|
-
}
|
602
|
-
check_fails(%r{\Amessage\.\n<.+> expected to respond to\n<return_argument\(\[false, "bogus"\]\)> with a true value.\Z}) {
|
603
|
-
assert_send([object, :return_argument, false, "bogus"], "message")
|
604
|
-
}
|
605
|
-
end
|
606
|
-
|
607
|
-
def test_condition_invariant
|
608
|
-
object = Object.new
|
609
|
-
def object.inspect
|
610
|
-
@changed = true
|
611
|
-
end
|
612
|
-
def object.==(other)
|
613
|
-
@changed ||= false
|
614
|
-
return (!@changed)
|
615
|
-
end
|
616
|
-
check_nothing_fails do
|
617
|
-
assert_equal(object, object, "message")
|
618
|
-
end
|
619
|
-
end
|
620
|
-
|
621
|
-
def test_assert_boolean
|
622
|
-
check_nothing_fails do
|
623
|
-
assert_boolean(true)
|
624
|
-
end
|
625
|
-
check_nothing_fails do
|
626
|
-
assert_boolean(false)
|
627
|
-
end
|
628
|
-
|
629
|
-
check_fails("<true> or <false> expected but was\n<1>") do
|
630
|
-
assert_boolean(1)
|
631
|
-
end
|
632
|
-
|
633
|
-
check_fails("<true> or <false> expected but was\n<nil>") do
|
634
|
-
assert_boolean(nil)
|
635
|
-
end
|
636
|
-
|
637
|
-
check_fails("message.\n<true> or <false> expected but was\n<\"XXX\">") do
|
638
|
-
assert_boolean("XXX", "message")
|
639
|
-
end
|
640
|
-
end
|
641
|
-
|
642
|
-
def test_assert_true
|
643
|
-
check_nothing_fails do
|
644
|
-
assert_true(true)
|
645
|
-
end
|
646
|
-
|
647
|
-
check_fails("<true> expected but was\n<false>") do
|
648
|
-
assert_true(false)
|
649
|
-
end
|
650
|
-
|
651
|
-
check_fails("<true> expected but was\n<1>") do
|
652
|
-
assert_true(1)
|
653
|
-
end
|
654
|
-
|
655
|
-
check_fails("message.\n<true> expected but was\n<nil>") do
|
656
|
-
assert_true(nil, "message")
|
657
|
-
end
|
658
|
-
end
|
659
|
-
|
660
|
-
def test_assert_false
|
661
|
-
check_nothing_fails do
|
662
|
-
assert_false(false)
|
663
|
-
end
|
664
|
-
|
665
|
-
check_fails("<false> expected but was\n<true>") do
|
666
|
-
assert_false(true)
|
667
|
-
end
|
668
|
-
|
669
|
-
check_fails("<false> expected but was\n<nil>") do
|
670
|
-
assert_false(nil)
|
671
|
-
end
|
672
|
-
|
673
|
-
check_fails("message.\n<false> expected but was\n<:false>") do
|
674
|
-
assert_false(:false, "message")
|
675
|
-
end
|
676
|
-
end
|
677
|
-
|
678
|
-
def add_failure(message, location=caller)
|
679
|
-
unless @catch_assertions
|
680
|
-
super
|
681
|
-
end
|
682
|
-
end
|
683
|
-
|
684
|
-
def add_assertion
|
685
|
-
if @catch_assertions
|
686
|
-
@actual_assertion_count += 1
|
687
|
-
else
|
688
|
-
super
|
689
|
-
end
|
690
|
-
end
|
691
|
-
end
|
692
|
-
end
|
693
|
-
end
|