| Å×½ºÆ® :: Ŭ·¡½º Test :: Class´Â XUnit / JUnit ½ºÅ¸ÀÏ·Î Å×½ºÆ® Ŭ·¡½º¸¦ ½±°Ô ¸¸µé ¼öÀÖ´Â Perl ¸ðµâÀÔ´Ï´Ù. |
Áö±Ý ´Ù¿î·Îµå |
Å×½ºÆ® :: Ŭ·¡½º ¼øÀ§ ¹× ¿ä¾à
- ƯÇã:
- Perl Artistic License
- °Ô½ÃÀÚ À̸§:
- Adrian Howard
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://search.cpan.org/~adie/Test-Block-0.11/lib/Test/Block.pm
Å×½ºÆ® :: Ŭ·¡½º ű×
Å×½ºÆ® :: Ŭ·¡½º ¼³¸í
Test :: Class´Â XUnit / Junit ½ºÅ¸ÀÏ·Î Å×½ºÆ® Ŭ·¡½º¸¦ ½±°Ô ¸¸µé ¼öÀÖ´Â Perl ¸ðµâÀÔ´Ï´Ù. Test :: Class´Â XUnit / Junit Style.synopsis ÆÐÅ°Áö ¿¹Á¦ :: Å×½ºÆ®;¿¡¼ Å×½ºÆ® Ŭ·¡½º¸¦ ½±°Ô ¸¸µé ¼öÀÖ´Â Perl ¸ðµâÀÔ´Ï´Ù. ±âº» QW (Test :: Class)¸¦ »ç¿ëÇϽʽÿÀ. Å×½ºÆ®¸¦ »ç¿ëÇϽʽÿÀ :: ±âŸ; # ¼³Ä¡ ¹æ¹ýÀº ¸ðµç Å×½ºÆ® ¹æ¹ý Àü¿¡ ½ÇÇàµË´Ï´Ù. SUB MAKE_FIXTURE : Å×½ºÆ® (¼³Á¤) {MY $ ARARY = ; Shift -> {TEST_ARRAY} = $ ARRAY; }; # 1 Å×½ºÆ® ÇÏÀ§ Å×½ºÆ®¸¦ ½ÇÇàÇÏ´Â Å×½ºÆ® ¹æ¹ý : Å×½ºÆ® {MY $ ARRAY = SHIFT -> {TEST_ARRAY}; Ǫ½Ã @ $ ARRAY, 3; is_deeply ($ ¾îAr, , 'Ǫ½Ã ÀÛ¾÷'); }; # 4 Å×½ºÆ® Sub Test_pop : Test (4) {My $ Array = Shift -> {TEST_ARRAY}À» ½ÇÇàÇÏ´Â Å×½ºÆ® ¹æ¹ý; (POP @ $ ARRARY, 2, 'POP = 2'); (POP @ $ ARRAY, 1, 'POP = 1'); is_deeply ($ heraly, [], '¹è¿'); (POP @ $ ARRAY, UNDEF, 'POP = UNDEF'); }; # TearDown ¸Þ¼Òµå´Â ¸ðµç Å×½ºÆ® ¹æ¹ý ÀÌÈÄ¿¡ ½ÇÇàµË´Ï´Ù. SUB Teardown : Å×½ºÆ® (Teardown) {My $ Array = Shift -> {test_array}; Diag ( "@ $ Array) Å×½ºÆ® ÈÄ"Array = (@ $ Array) "); }; ³ªÁß¿¡ ±ÙóÀÇ .t ÆÄÀÏ #! / usr / bin / perl »ç¿ë ¿¹ :: Å×½ºÆ®; # ¿¹Á¦ :: Å×½ºÆ® Å×½ºÆ® :: Ŭ·¡½º -> runtests; Ãâ·Â : 1..5 OK 1 - ÆË = 2 OK 2 - ÆË = 1 OK 3 - ¹è¿ ºó È®ÀÎ 4 - ÆË = undef # ¹è¿ = () Å×½ºÆ® ÈÄ 5 - Å×½ºÆ® ÈÄ Çª½Ã ÀÛ¾÷ # ¹è¿ = (12 3) ¿ä±¸ »çÇ× ¿ä±¸ »çÇ× : ¡¤ Perl.
Å×½ºÆ® :: Ŭ·¡½º °ü·Ã ¼ÒÇÁÆ®¿þ¾î