├── .gitignore ├── 3rdparty ├── Unicode │ ├── 11.0.0 │ │ └── ucd │ │ │ └── auxiliary │ │ │ └── GraphemeBreakTest.txt │ ├── 13.0.0 │ │ └── ucd │ │ │ └── auxiliary │ │ │ └── GraphemeBreakTest.txt │ ├── 15.0.0 │ │ ├── LineBreak.txt │ │ ├── UnicodeData.txt │ │ ├── extracted │ │ │ └── DerivedGeneralCategory.txt │ │ └── ucd │ │ │ └── auxiliary │ │ │ └── GraphemeBreakTest.txt │ └── LICENSE └── wikipedia │ ├── Arabic.txt │ ├── Hangul.txt │ ├── LICENSE │ └── Tibetan.txt ├── 6.c ├── APPENDICES │ ├── A03-older-specs │ │ └── 01-misc.t │ └── A04-experimental │ │ └── 01-misc.t ├── MISC │ ├── bug-coverage-stress.t │ ├── bug-coverage.t │ └── misc-6.c.t ├── S02-names │ ├── SETTING-6c.t │ └── pseudo-6c.t ├── S02-types │ └── subset-6c.t ├── S03-operators │ └── set_precedes.t ├── S04-declarations │ └── my-6c.t ├── S05-grammar │ ├── methods.t │ └── parse_and_parsefile-6c.t ├── S06-other │ └── main-refactored.t ├── S12-class │ └── mro-6c.t ├── S14-roles │ ├── attributes.t │ ├── mixin-6c.t │ └── submethods.t └── S32-io │ └── file-tests.t ├── 6.d ├── S02-literals │ └── version.t └── S32-str │ ├── sprintf-b.t │ ├── sprintf-c.t │ ├── sprintf-d.t │ ├── sprintf-e.t │ ├── sprintf-f.t │ ├── sprintf-o.t │ ├── sprintf-s.t │ ├── sprintf-u.t │ ├── sprintf-x.t │ └── sprintf.t ├── APPENDICES ├── A01-limits │ ├── misc.t │ └── overflow.t ├── A02-some-day-maybe │ ├── concreteness.t │ ├── io-cathandle.t │ ├── misc.t │ └── multi-no-match.t └── README.md ├── CONTRIBUTING.md ├── LICENSE ├── MISC ├── bug-coverage-6.d.t ├── bug-coverage-stress.t └── misc.t ├── README.md ├── S01-perl-5-integration ├── README ├── array.t ├── basic.t ├── class.t ├── context.t ├── eval_lex.t ├── exception_handling.t ├── hash.t ├── import.t ├── isms.t ├── method.t ├── return.t ├── roundtrip.t ├── strings.t └── subs.t ├── S02-lexical-conventions ├── bom.t ├── comments.t ├── finish-pod.t ├── minimal-whitespace.t ├── one-pass-parsing.t ├── pod-in-multi-line-exprs.t ├── sub-block-parsing.t ├── unicode-whitespace.t ├── unicode.t └── unspace.t ├── S02-lists ├── indexing.t └── tree.t ├── S02-literals ├── adverbs.t ├── allomorphic.t ├── array-interpolation.t ├── autoref.t ├── char-by-name.t ├── char-by-number.t ├── fmt-interpolation.t ├── format.t ├── hash-interpolation.t ├── heredocs.t ├── hex_chars.t ├── listquote-whitespace.t ├── listquote.t ├── misc-interpolation.t ├── numeric.t ├── pair-boolean.t ├── pairs.t ├── pod.t ├── quoting-unicode.t ├── quoting.t ├── radix.t ├── string-interpolation.t ├── sub-calls.t ├── subscript.t ├── types.t ├── underscores.t └── version.t ├── S02-magicals ├── 78258.t ├── DISTRO.t ├── GROUP.t ├── KERNEL.t ├── PERL.t ├── RAKU.t ├── USER.t ├── UsedEnv.rakumod ├── VM.t ├── args.t ├── block.t ├── dollar-underscore.t ├── dollar_bang.t ├── env.t ├── file_line.t ├── pid.t ├── progname.t ├── sub.t └── subname.t ├── S02-names-vars ├── contextual.t ├── fmt.t ├── list_array_perl.t ├── names.t ├── perl.t ├── signature.t ├── variables-and-packages.t └── varnames.t ├── S02-names ├── SETTING-6e.t ├── bare-sigil.t ├── caller.t ├── dynamic-scope.t ├── identifier.t ├── indirect.t ├── is_default.t ├── is_dynamic.t ├── name.t ├── our.t ├── pseudo-6d.t ├── pseudo-6e.t ├── strict.t └── symbolic-deref.t ├── S02-one-pass-parsing ├── less-than.t └── misc.t ├── S02-packages └── package-lookup.t ├── S02-types ├── WHICH.t ├── anon_block.t ├── array-shapes.t ├── array.t ├── array_extending.t ├── array_ref.t ├── assigning-refs.t ├── autovivification.t ├── bag-iterator.t ├── bag.t ├── baggy.t ├── baghash.t ├── bool.t ├── built-in.t ├── capture.t ├── catch_type_cast_mismatch.t ├── compact.t ├── declare.t ├── fatrat.t ├── flattening.t ├── generics.t ├── hash.t ├── hash_ref.t ├── hyperwhatever.t ├── infinity.t ├── instants-and-durations.t ├── int-uint.t ├── is-type.t ├── isDEPRECATED.t ├── lazy-lists.t ├── list.t ├── lists.t ├── mix-iterator.t ├── mix.t ├── mixed_multi_dimensional.t ├── mixhash.t ├── mu.t ├── multi_dimensional_array.t ├── nan.t ├── native.t ├── nested_arrays.t ├── nested_pairs.t ├── nil.t ├── nominalizables.t ├── num.t ├── pair.t ├── parsing-bool.t ├── range-iterator.t ├── range.t ├── resolved-in-setting.t ├── set-iterator.t ├── set.t ├── sethash.t ├── sigils-and-types.t ├── signed-unsigned-native.t ├── stash.t ├── subscripts_and_context.t ├── subset-6e.t ├── type.t ├── undefined-types.t ├── unicode.t ├── version-stress.t ├── version.t └── whatever.t ├── S03-binding ├── arrays.t ├── attributes.t ├── closure.t ├── hashes.t ├── nested.t ├── ro.t └── scalars.t ├── S03-buf ├── read-int.t ├── read-num.t ├── read-write-bits.t ├── write-int.t └── write-num.t ├── S03-feeds └── basic.t ├── S03-junctions ├── associative.t ├── autothreading.t ├── boolean-context.t └── misc.t ├── S03-metaops ├── cross.t ├── eager-hyper.t ├── hyper.t ├── infix.t ├── misc.t ├── not.t ├── reduce.t ├── reverse.t └── zip.t ├── S03-operators ├── adverbial-modifiers.t ├── also.t ├── andthen.t ├── arith.t ├── assign-is-not-binding.t ├── assign.t ├── autoincrement-range.t ├── autoincrement.t ├── autovivification.t ├── basic-types.t ├── bit.t ├── boolean-bitwise.t ├── brainos.t ├── buf.t ├── chained-declarators.t ├── cmp.t ├── comparison-simple.t ├── comparison.t ├── composition.t ├── context-forcers.t ├── context.t ├── custom.t ├── div.t ├── equality.t ├── eqv.t ├── flip-flop.t ├── gcd.t ├── identity.t ├── increment.t ├── infixed-function.t ├── inplace.t ├── is-divisible-by.t ├── lcm.t ├── list-quote-junction.t ├── minmax.t ├── misc.t ├── names.t ├── nesting.t ├── not.t ├── notandthen.t ├── numeric-shift.t ├── orelse.t ├── overflow.t ├── precedence.t ├── range-basic.t ├── range-int.t ├── range.t ├── reduce-le1arg.t ├── relational.t ├── repeat.t ├── scalar-assign.t ├── set_addition.t ├── set_difference.t ├── set_elem.t ├── set_equality.t ├── set_intersection.t ├── set_multiply.t ├── set_proper_subset.t ├── set_subset.t ├── set_symmetric_difference.t ├── set_union.t ├── short-circuit.t ├── so.t ├── spaceship-and-containers.t ├── spaceship.t ├── subscript-adverbs.t ├── subscript-vs-lt.t ├── ternary.t ├── u2212-minus.t └── value_equivalence.t ├── S03-sequence ├── arity-2-or-more.t ├── arity0.t ├── basic.t ├── exhaustive.t ├── limit-arity-2-or-more.t ├── misc.t └── nonnumeric.t ├── S03-smartmatch ├── 00-sanity.t ├── any-any.t ├── any-bool.t ├── any-callable.t ├── any-complex.t ├── any-hash-pair.t ├── any-method.t ├── any-num.t ├── any-pair.t ├── any-str.t ├── any-sub.t ├── any-type.t ├── array-array.t ├── array-hash.t ├── array-map.t ├── capture-signature.t ├── disorganized.t ├── hash-hash.t ├── range-range.t ├── regex-hash.t ├── scalar-hash.t └── signature-signature.t ├── S04-blocks-and-statements ├── let.t ├── pointy-rw.t ├── pointy.t └── temp.t ├── S04-declarations ├── constant-6.d.t ├── constant.t ├── implicit-parameter.t ├── multiple.t ├── my-6e.t ├── our.t ├── smiley.t ├── state.t └── will.t ├── S04-exception-handlers ├── catch.t ├── control.t └── top-level.t ├── S04-exceptions ├── control_across_runloop.t ├── exceptions-alternatives.t ├── fail-6e.t ├── fail.t └── pending.t ├── S04-phasers ├── ascending-order.t ├── begin.t ├── check.t ├── descending-order.t ├── end.t ├── enter-leave.t ├── exit-in-check.t ├── first.t ├── in-eval.t ├── in-loop.t ├── init.t ├── interpolate.t ├── keep-undo.t ├── multiple.t ├── next.t ├── pre-post.t └── rvalue.t ├── S04-statement-modifiers ├── for.t ├── given.t ├── if.t ├── unless.t ├── until.t ├── values_in_bool_context.t ├── while.t ├── with.t └── without.t ├── S04-statement-parsing └── hash.t ├── S04-statements ├── do.t ├── for-scope.t ├── for.t ├── for_with_only_one_item.t ├── gather.t ├── given.t ├── goto.t ├── if.t ├── label.t ├── last.t ├── lazy.t ├── leave.t ├── loop.t ├── map-and-sort-in-for.t ├── next.t ├── no-implicit-block.t ├── once.t ├── quietly.t ├── redo.t ├── repeat.t ├── return.t ├── sink.t ├── terminator.t ├── try.t ├── unless.t ├── until.t ├── when.t ├── while.t └── with.t ├── S05-capture ├── alias.t ├── array-alias.t ├── caps.t ├── dot.t ├── hash.t ├── match-object.t ├── named.t └── subrule.t ├── S05-grammar ├── action-stubs.t ├── example.t ├── inheritance.t ├── namespace-6e.t ├── namespace.t ├── parse_and_parsefile-6e.t ├── polymorphism.t ├── protoregex.t ├── protos.t ├── signatures.t └── ws.t ├── S05-interpolation ├── lexicals.t └── regex-in-variable.t ├── S05-mass ├── charsets.t ├── named-chars.t ├── properties-block.t ├── properties-contributory.t ├── properties-derived.t ├── properties-general.t ├── properties-script.t ├── recursive.t ├── rx.t └── stdrules.t ├── S05-match ├── arrayhash.t ├── basics.t ├── blocks.t ├── capturing-contexts.t ├── make.t ├── non-capturing.t ├── positions.t └── raku.t ├── S05-metachars ├── closure.t ├── line-anchors.t ├── newline.t └── tilde.t ├── S05-metasyntax ├── angle-brackets.t ├── assertions.t ├── changed.t ├── charset.t ├── delimiters.t ├── interpolating-closure.t ├── litvar.t ├── longest-alternative.t ├── lookaround.t ├── null.t ├── proto-token-ltm.t ├── regex.t ├── repeat.t ├── sequential-alternation.t ├── single-quotes.t ├── unicode-property-pair.t └── unknown.t ├── S05-modifier ├── Perl_0.t ├── Perl_1.t ├── Perl_10.t ├── Perl_2.t ├── Perl_3.t ├── Perl_4.t ├── Perl_5.t ├── Perl_6.t ├── Perl_7.t ├── Perl_8.t ├── Perl_9.t ├── continue.t ├── counted-match.t ├── counted.t ├── exhaustive.t ├── global.t ├── ignorecase-and-ignoremark.t ├── ignorecase.t ├── ignoremark.t ├── ii.t ├── my.t ├── overlapping.t ├── pos.t ├── ratchet.t ├── repetition-exhaustive.t ├── repetition.t ├── samemark.t └── sigspace.t ├── S05-nonstrings └── basic.t ├── S05-substitution ├── 67222.t ├── match.t └── subst.t ├── S05-syntactic-categories └── new-symbols.t ├── S05-transliteration ├── 79778.t ├── trans-TR-operator.t ├── trans-tr-lowercase-operator.t ├── trans.t └── with-closure.t ├── S06-advanced ├── caller.t ├── callframe.t ├── callsame.t ├── dispatching.t ├── lexical-subs.t ├── recurse.t ├── return.t ├── return_function.t ├── stub.t └── wrap.t ├── S06-currying ├── assuming-and-mmd.t ├── misc.t ├── named.t ├── positional.t └── slurpy.t ├── S06-multi ├── by-trait.t ├── compile-time.t ├── lexical-multis.t ├── positional-vs-named.t ├── proto.t ├── redispatch.t ├── subsignature.t ├── syntax.t ├── type-based.t ├── unpackability.t └── value-based.t ├── S06-operator-overloading ├── circumfix.t ├── imported-subs.t ├── infix.t ├── methods.t ├── prefix.t ├── semicolon.t ├── sub.t ├── term.t └── workout.t ├── S06-other ├── anon-hashes-vs-blocks.t ├── introspection.t ├── main-eval.t ├── main-semicolon.t ├── main-usage.t ├── main.t ├── misc.t └── pairs-as-lvalues.t ├── S06-parameters └── smiley.t ├── S06-routine-modifiers ├── lvalue-subroutines.t ├── native-lvalue-subroutines.t ├── proxy.t └── scoped-named-subs.t ├── S06-signature ├── arity.t ├── closure-over-parameters.t ├── closure-parameters.t ├── code.t ├── defaults.t ├── definite-return.t ├── errors.t ├── introspection.t ├── mixed-placeholders.t ├── multi-invocant.t ├── multidimensional.t ├── multiple-signatures.t ├── named-parameters.t ├── named-placeholders.t ├── named-renaming.t ├── optional.t ├── outside-subroutine.t ├── passing-arrays.t ├── passing-hashes.t ├── positional-placeholders.t ├── positional.t ├── scalar-type.t ├── shape.t ├── sigilless.t ├── slurpy-and-interpolation.t ├── slurpy-blocks.t ├── slurpy-params.t ├── slurpy-placeholders.t ├── sub-ref.t ├── tree-node-parameters.t ├── type-capture.t ├── types.t ├── unpack-array.t ├── unpack-object.t └── unspecified.t ├── S06-traits ├── as.t ├── is-assoc.t ├── is-copy.t ├── is-readonly.t ├── is-rw.t ├── misc.t ├── native-is-copy.t ├── native-is-rw.t ├── precedence.t └── slurpy-is-rw.t ├── S07-hyperrace ├── basics.t ├── for.t └── stress.t ├── S07-iterationbuffer └── iterationbuffer.t ├── S07-iterators └── range-iterator.t ├── S07-slip └── slip.t ├── S09-autovivification ├── autoincrement.t └── autovivification.t ├── S09-hashes └── objecthash.t ├── S09-multidim ├── XX-POS-on-dimensioned.t ├── XX-POS-on-undimensioned.t ├── assign.t ├── decl.t ├── indexing.t ├── methods.t └── subs.t ├── S09-subscript ├── multidim-assignment.t └── slice.t ├── S09-typed-arrays ├── arrays.t ├── hashes.t ├── native-decl.t ├── native-int.t ├── native-num.t ├── native-shape1-int.t ├── native-shape1-num.t ├── native-shape1-str.t ├── native-str.t └── native.t ├── S10-packages ├── README ├── basic.t ├── export.t ├── joined-namespaces.t ├── nested-use.t ├── precompilation.t ├── require-and-use--dead-file.t ├── require-and-use.t ├── scope.t └── use-with-class.t ├── S11-compunit ├── compunit-dependencyspecification.t ├── compunit-repository.t └── rt126904.t ├── S11-modules ├── export.t ├── gh2979.t ├── import-multi.t ├── import-tag.t ├── import.t ├── importing.t ├── lexical.t ├── module-file.t ├── module.t ├── need.t ├── nested.t ├── rakulib.t ├── re-export.t ├── require.t ├── runtime.t └── versioning.t ├── S11-repository ├── cur-candidates.t ├── cur-current-distribution.t └── curli-install.t ├── S12-attributes ├── augment-and-initialization.t ├── class.t ├── clone.t ├── defaults.t ├── delegation.t ├── inheritance.t ├── instance.t ├── mutators.t ├── native.t ├── recursive.t ├── smiley.t ├── trusts.t └── undeclared.t ├── S12-class ├── anonymous.t ├── attributes-required.t ├── attributes.t ├── augment-supersede.t ├── basic.t ├── declaration-order.t ├── extending-arrays.t ├── inheritance-class-methods.t ├── inheritance.t ├── instantiate.t ├── interface-consistency.t ├── lexical.t ├── literal.t ├── magical-vars.t ├── mro-6e.t ├── namespaced.t ├── open.t ├── open_closed.t ├── parent_attributes.t ├── rw.t ├── self-inheritance.t ├── stubs.t └── type-object.t ├── S12-coercion ├── coercion-methods.t ├── coercion-return.t ├── coercion-types.t └── parameterized.t ├── S12-construction ├── BUILD.t ├── TWEAK.t ├── autopairs.t ├── construction.t ├── destruction.t ├── named-params-in-BUILD.t ├── new.t └── roles-6e.t ├── S12-enums ├── anonymous.t ├── as-role.t ├── basic.t ├── misc.t ├── non-int.t ├── pseudo-functional.t └── thorough.t ├── S12-introspection ├── WHAT.t ├── attributes.t ├── can.t ├── definite.t ├── meta-class.t ├── methods.t ├── parents.t ├── roles.t └── walk.t ├── S12-meta ├── classhow.t ├── exporthow.t ├── grammarhow.t └── primitives.t ├── S12-methods ├── accessors.t ├── attribute-params.t ├── calling_sets.t ├── calling_syntax.t ├── chaining.t ├── class-and-instance.t ├── default-trait.t ├── defer-call.t ├── defer-next.t ├── delegation.t ├── fallback.t ├── how.t ├── indirect_notation.t ├── instance.t ├── lastcall.t ├── lvalue.t ├── method-vs-sub.t ├── multi.t ├── parallel-dispatch.t ├── private.t ├── qualified.t ├── submethods.t ├── syntax.t ├── topic.t ├── trusts.t ├── typed-attributes.t └── what.t ├── S12-subset ├── multi-dispatch.t ├── subtypes.t └── type-subset.t ├── S12-traits ├── basic.t ├── custom │ ├── client.rakumod │ └── customtrait.rakumod ├── parameterized.t └── precomp.t ├── S13-overloading ├── fallbacks-deep.t ├── metaoperators.t ├── multiple-signatures.t ├── operators.t └── typecasting-long.t ├── S13-syntax └── aliasing.t ├── S13-type-casting └── methods.t ├── S14-roles ├── anonymous.t ├── attributes-6e.t ├── basic.t ├── bool.t ├── composition.t ├── conflicts.t ├── crony.t ├── generic-subtyping.t ├── instantiation.t ├── lexical.t ├── mixin-6e.t ├── namespaced.t ├── parameter-subtyping.t ├── parameterized-basic.t ├── parameterized-mixin.t ├── parameterized-type.t ├── rw.t ├── stubs.t ├── submethods-6e.t ├── typecheck.t └── versioning.t ├── S14-traits ├── attributes.t ├── package.t ├── routines.t └── variables.t ├── S15-literals ├── identifiers.t └── numbers.t ├── S15-nfg ├── GraphemeBreakTest.t ├── case-change.t ├── cgj.t ├── concat-stable.t ├── concatenation.t ├── crlf-encoding.t ├── emoji-test-gen.raku ├── emoji-test.t ├── from-buf.t ├── from-file.t ├── grapheme-break.t ├── long-uni.t ├── many-combiners.t ├── many-threads.t ├── mass-equality-gen.raku ├── mass-equality.t ├── mass-roundtrip-nfc.t ├── mass-roundtrip-nfd.t ├── mass-roundtrip-nfkc.t ├── mass-roundtrip-nfkd.t ├── mass-roundtrip-test-gen.raku └── regex.t ├── S15-normalization ├── nfc-0.t ├── nfc-1.t ├── nfc-2.t ├── nfc-3.t ├── nfc-4.t ├── nfc-5.t ├── nfc-6.t ├── nfc-7.t ├── nfc-8.t ├── nfc-9.t ├── nfc-concat.t ├── nfc-sanity.t ├── nfd-0.t ├── nfd-1.t ├── nfd-2.t ├── nfd-3.t ├── nfd-4.t ├── nfd-5.t ├── nfd-6.t ├── nfd-7.t ├── nfd-8.t ├── nfd-9.t ├── nfd-sanity.t ├── nfkc-0.t ├── nfkc-1.t ├── nfkc-2.t ├── nfkc-3.t ├── nfkc-4.t ├── nfkc-5.t ├── nfkc-6.t ├── nfkc-7.t ├── nfkc-8.t ├── nfkc-9.t ├── nfkc-sanity.t ├── nfkd-0.t ├── nfkd-1.t ├── nfkd-2.t ├── nfkd-3.t ├── nfkd-4.t ├── nfkd-5.t ├── nfkd-6.t ├── nfkd-7.t ├── nfkd-8.t ├── nfkd-9.t ├── nfkd-sanity.t └── test-gen.raku ├── S15-string-types ├── NF-types.t ├── NFK-types.t ├── Str.t └── Uni.t ├── S15-unicode-information ├── unimatch-general.t ├── uniname.t ├── uniprop.t └── unival.t ├── S16-filehandles ├── argfiles.t ├── chmod.t ├── filestat.t ├── filetest.t ├── io.t ├── io_in_for_loops.t ├── io_in_while_loops.t ├── misc.t ├── mkdir_rmdir.t ├── mode.t ├── open.t └── unlink.t ├── S16-io ├── bare-say.t ├── basic-open.t ├── bom.t ├── comb.t ├── cwd.t ├── eof.t ├── getc.t ├── handles-between-threads.t ├── home.t ├── lines.t ├── newline.t ├── note.t ├── print.t ├── prompt.t ├── put.t ├── readchars.t ├── say-and-ref.t ├── say.t ├── split.t ├── supply.t ├── test-data ├── tmpdir.t ├── watch.t └── words.t ├── S16-unfiled ├── getpeername.t └── rebindstdhandles.t ├── S17-channel ├── basic.t ├── stress.t └── subscription-drain-in-react.t ├── S17-lowlevel ├── atomic-ops.t ├── atomic.t ├── cas-int.t ├── cas-loop-int.t ├── cas-loop.t ├── cas.t ├── lock.t ├── semaphore.t ├── thread-start-join-stress.t └── thread.t ├── S17-procasync ├── basic.t ├── bind-handles.t ├── encoding.t ├── kill.t ├── many-processes-no-close-stdin.t ├── no-runaway-file-limit.t ├── nonexistent.t ├── print.t ├── stress.t ├── windows-arg-quoting.t └── windows-print-raw-args.raku ├── S17-promise ├── allof.t ├── anyof.t ├── at.t ├── basic.t ├── in.t ├── lock-async-stress.t ├── lock-async-stress2.t ├── lock-async.t ├── nonblocking-await.t ├── single-assignment.t ├── start.t ├── stress.t └── then.t ├── S17-scheduler ├── at.t ├── basic.t ├── every.t ├── in.t └── times.t ├── S17-supply ├── Channel.t ├── Promise.t ├── Seq.t ├── act.t ├── basic.t ├── batch.t ├── categorize.t ├── classify.t ├── collate.t ├── comb.t ├── construction-recursion.t ├── decode.t ├── delayed.t ├── do.t ├── elems.t ├── encode.t ├── first.t ├── flat.t ├── from-list.t ├── grab.t ├── grep.t ├── head.t ├── interval.t ├── lines.t ├── list.t ├── map.t ├── max.t ├── merge.t ├── migrate.t ├── min.t ├── minmax.t ├── on-demand.t ├── produce.t ├── reduce.t ├── repeated.t ├── return-in-tap.t ├── reverse.t ├── rotate.t ├── rotor.t ├── schedule-on.t ├── skip.t ├── snip.t ├── sort.t ├── split.t ├── squish.t ├── stable.t ├── start.t ├── supplier-preserving.t ├── syntax-nonblocking-await.t ├── syntax.t ├── tail.t ├── throttle.t ├── unique.t ├── wait.t ├── watch-path.t ├── words.t ├── zip-latest.t └── zip.t ├── S19-command-line-options ├── 01-dash-uppercase-i.t ├── 02-dash-n.t ├── 03-dash-p.t └── 04-negation.t ├── S19-command-line ├── arguments.t ├── dash-e.t ├── help.t └── repl.t ├── S22-package-format └── local.t ├── S24-testing ├── 0-compile.t ├── 1-basic.t ├── 10-is-approx.t ├── 11-plan-skip-all-subtests.t ├── 11-plan-skip-all.t ├── 12-subtest-todo.t ├── 13-cmp-ok.t ├── 14-like-unlike.t ├── 15-done-testing.t ├── 2-force_todo.t ├── 3-output.t ├── 6-done_testing.t ├── 7-bail_out.t ├── 8-die_on_fail.t ├── 9-is_deeply.t ├── fails-like.t ├── line-numbers.t ├── test-data │ ├── README │ ├── line-number-bar-ok.txt │ ├── line-number-cmp-ok.txt │ ├── line-number-dies-ok.txt │ ├── line-number-eval-dies-ok.txt │ ├── line-number-eval-lives-ok.txt │ ├── line-number-foo-ok.txt │ ├── line-number-is-approx.txt │ ├── line-number-is-deeply.txt │ ├── line-number-is.txt │ ├── line-number-isa-ok.txt │ ├── line-number-isnt.txt │ ├── line-number-lives-ok.txt │ ├── line-number-nok.txt │ ├── line-number-ok.txt │ ├── line-number-throws-like.txt │ └── todo-passed.txt └── use_ok_test.rakumod ├── S26-documentation ├── 01-delimited.t ├── 02-paragraph.t ├── 03-abbreviated.t ├── 04-code.t ├── 04a-input-output.t ├── 05-comment.t ├── 06-lists.t ├── 07-tables.t ├── 07a-tables.t ├── 07b-tables.t ├── 07c-tables.t ├── 08-formattingcodes.t ├── 09-configuration.t ├── 10-doc-cli.t ├── 12-non-breaking-space.t ├── 14-defn.t ├── 15-numbered-alias.t ├── block-leading-user-format.t ├── block-leading.t ├── block-trailing.t ├── module-comment.t ├── multiline-leading.t ├── multiline-trailing.t ├── wacky.t ├── why-both.t ├── why-leading.t └── why-trailing.t ├── S28-named-variables ├── cwd.t ├── init-instant.t └── slangs.t ├── S29-any ├── are.t ├── cmp.t ├── deg-trans.t ├── isa.t └── minpairs-maxpairs.t ├── S29-context ├── die.t ├── eval.t ├── evalfile.t ├── exit-in-if.t ├── exit.t └── sleep.t ├── S29-conversions ├── hash.t └── ord_and_chr.t ├── S29-os └── system.t ├── S32-array ├── adverbs.t ├── bool.t ├── create.t ├── delete-adverb-native.t ├── delete-adverb.t ├── delete.t ├── elems.t ├── end.t ├── exists-adverb.t ├── keys_values.t ├── kv.t ├── multislice-6e.t ├── pairs.t ├── perl.t ├── pop.t ├── push.t ├── rotate.t ├── shift.t ├── splice.t └── unshift.t ├── S32-basics ├── pairup.t ├── warn.t ├── xxKEY.t ├── xxPOS-native.t └── xxPOS.t ├── S32-container ├── buf.t ├── cat.t ├── roundrobin.t ├── stringify.t └── zip.t ├── S32-encoding ├── decoder.t ├── encoder.t └── registry.t ├── S32-exceptions ├── misc.t └── misc2.t ├── S32-hash ├── adverbs.t ├── antipairs.t ├── delete-adverb.t ├── delete.t ├── exists-adverb.t ├── exists.t ├── hyperslice.t ├── invert.t ├── iterator.t ├── keys_values.t ├── kv.t ├── map.t ├── multislice-6e.t ├── pairs.t ├── perl.t ├── push.t └── slice.t ├── S32-io ├── IO-Socket-Async-UDP.t ├── IO-Socket-Async.t ├── IO-Socket-INET-UNIX.t ├── IO-Socket-INET.t ├── chdir-process.t ├── chdir.t ├── child-secure.t ├── copy.t ├── dir.t ├── empty.txt ├── indir.t ├── io-cathandle.t ├── io-handle.t ├── io-path-cygwin.t ├── io-path-extension.t ├── io-path-subclasses.t ├── io-path-symlink.t ├── io-path-unix.t ├── io-path-win.t ├── io-path.t ├── io-spec-cygwin.t ├── io-spec-qnx.t ├── io-spec-unix.t ├── io-spec-win.t ├── io-special.t ├── lock.t ├── mkdir_rmdir.t ├── move.t ├── native-descriptor.t ├── note.t ├── null-char.t ├── open.t ├── other-stress.t ├── other.t ├── out-buffering.t ├── pi.txt ├── pipe.t ├── rename.t ├── seek.t ├── signals.t ├── slurp.t ├── socket-accept-and-working-threads.t ├── socket-fail-invalid-values.t ├── socket-host-port-split.t ├── socket-recv-vs-read.t ├── spurt.t ├── tell.t ├── utf16-test │ ├── sample-UTF-16.txt │ ├── sample-UTF-16BE-bom.txt │ ├── sample-UTF-16BE.txt │ ├── sample-UTF-16LE-bom.txt │ ├── sample-UTF-16LE.txt │ └── sample-UTF-8.txt └── utf16.t ├── S32-list ├── are.t ├── batch.t ├── categorize-list.t ├── categorize.t ├── classify-list.t ├── classify.t ├── combinations.t ├── create.t ├── cross.t ├── deepmap.t ├── duckmap.t ├── end.t ├── first-end-k.t ├── first-end-kv.t ├── first-end-p.t ├── first-end-v.t ├── first-end.t ├── first-k.t ├── first-kv.t ├── first-p.t ├── first-v.t ├── first.t ├── flat.t ├── grep-k.t ├── grep-kv.t ├── grep-p.t ├── grep-v.t ├── grep.t ├── head.t ├── iterator.t ├── join.t ├── map.t ├── map_function_return_values.t ├── minmax.t ├── numbers.data ├── permutations.t ├── pick.t ├── produce.t ├── reduce.t ├── repeated.t ├── reverse.t ├── roll.t ├── rotor.t ├── seq.t ├── skip.t ├── snip.t ├── sort.t ├── squish.t ├── tail.t ├── toggle.t └── unique.t ├── S32-num ├── abs.t ├── base.t ├── complex-logarithms.t ├── complex.t ├── cool-num.t ├── exp.t ├── expmod.t ├── fatrat.t ├── int.t ├── is-prime.t ├── log.t ├── narrow.t ├── negative-zero.t ├── pi.t ├── polar.t ├── polymod.t ├── power.t ├── rand.t ├── rat.t ├── real-bridge.t ├── roots.t ├── rounders.t ├── rshift_pos_amount.t ├── sign.t ├── sqrt.t ├── stress.t ├── stringify.t └── unpolar.t ├── S32-scalar ├── defined.t ├── perl.t └── undef.t ├── S32-str ├── Collation.t ├── CollationTestGen.raku ├── CollationTest_NON_IGNORABLE-0.t ├── CollationTest_NON_IGNORABLE-1.t ├── CollationTest_NON_IGNORABLE-2.t ├── CollationTest_NON_IGNORABLE-3.t ├── append.t ├── bool.t ├── capitalize.t ├── chomp.t ├── chop.t ├── comb.t ├── contains.t ├── encode.t ├── ends-with.t ├── fc.t ├── flip.t ├── format.t ├── gb18030-encode-decode.t ├── gb2312-encode-decode.t ├── indent.t ├── index.t ├── indices.t ├── lc.t ├── length.t ├── lines.t ├── numeric.t ├── ords.t ├── parse-base.t ├── pos.t ├── rindex.t ├── samecase.t ├── samemark.t ├── shiftjis-encode-decode.t ├── space-chars.t ├── split-simple.t ├── split.t ├── sprintf-b.t ├── sprintf-c.t ├── sprintf-d.t ├── sprintf-e.t ├── sprintf-f.t ├── sprintf-o.t ├── sprintf-s.t ├── sprintf-u.t ├── sprintf-x.t ├── sprintf.t ├── starts-with.t ├── substr-eq.t ├── substr-rw.t ├── substr.t ├── tc.t ├── tclc.t ├── text-samples │ ├── gb18030_sample_in_gb18030.txt │ ├── gb18030_sample_in_utf8.txt │ ├── gb2312_sample_in_gb2312.txt │ ├── gb2312_sample_in_utf8.txt │ ├── shiftjis_sample.txt │ └── shiftjis_sample_in_utf8.txt ├── trim.t ├── uc.t ├── uniparse.t ├── utf8-c8.t ├── val.t ├── windows-1251-windows-1252-encode-decode.t └── words.t ├── S32-temporal ├── Date.t ├── DateTime-Instant-Duration.t ├── DateTime.t ├── baum-gregorian-data.t ├── calendar.t ├── greg-jd-frac-seconds.t ├── juliandate.t ├── local.t └── time.t ├── S32-trig ├── TrigTestSupport ├── atan2.t ├── cos.t ├── cosec.t ├── cosech.t ├── cosh.t ├── cotan.t ├── cotanh.t ├── e.t ├── generate-tests.raku ├── pi.t ├── sec.t ├── sech.t ├── simple.t ├── sin.t ├── sinh.t ├── tan.t ├── tanh.t └── trig_functions ├── TODO ├── VERSION ├── docs ├── New-Features-Policy.md ├── announce │ ├── 6.d.md │ └── 6.e.md ├── release-guide.md └── unicode-generated-tests.asciidoc ├── fudge ├── fudgeall ├── fudgeandrun ├── integration ├── 99problems-01-to-10.t ├── 99problems-11-to-20.t ├── 99problems-21-to-30.t ├── 99problems-31-to-40.t ├── 99problems-41-to-50.t ├── 99problems-51-to-60.t ├── 99problems-61-to-70.t ├── advent2009-day01.t ├── advent2009-day02.t ├── advent2009-day03.t ├── advent2009-day04.t ├── advent2009-day05.t ├── advent2009-day06.t ├── advent2009-day07.t ├── advent2009-day08.t ├── advent2009-day09.t ├── advent2009-day10.t ├── advent2009-day11.t ├── advent2009-day12.t ├── advent2009-day13.t ├── advent2009-day14.t ├── advent2009-day15.t ├── advent2009-day16.t ├── advent2009-day17.t ├── advent2009-day18.t ├── advent2009-day19.t ├── advent2009-day20.t ├── advent2009-day21.t ├── advent2009-day22.t ├── advent2009-day23.t ├── advent2009-day24.t ├── advent2010-day03.t ├── advent2010-day04.t ├── advent2010-day06.t ├── advent2010-day07.t ├── advent2010-day08.t ├── advent2010-day10.t ├── advent2010-day11.t ├── advent2010-day12.t ├── advent2010-day14.t ├── advent2010-day16.t ├── advent2010-day19.t ├── advent2010-day21.t ├── advent2010-day22.t ├── advent2010-day23.t ├── advent2011-day03.t ├── advent2011-day04.t ├── advent2011-day05.t ├── advent2011-day07.t ├── advent2011-day10.t ├── advent2011-day11.t ├── advent2011-day14.t ├── advent2011-day15.t ├── advent2011-day16.t ├── advent2011-day20.t ├── advent2011-day22.t ├── advent2011-day23.t ├── advent2011-day24.t ├── advent2012-day02.t ├── advent2012-day03.t ├── advent2012-day04.t ├── advent2012-day06.t ├── advent2012-day09.t ├── advent2012-day10.t ├── advent2012-day12.t ├── advent2012-day13.t ├── advent2012-day14.t ├── advent2012-day15.t ├── advent2012-day16.t ├── advent2012-day19.t ├── advent2012-day20.t ├── advent2012-day21.t ├── advent2012-day22.t ├── advent2012-day24.t ├── advent2013-day02.t ├── advent2013-day04.t ├── advent2013-day06.t ├── advent2013-day07.t ├── advent2013-day08.t ├── advent2013-day09.t ├── advent2013-day10.t ├── advent2013-day12.t ├── advent2013-day14.t ├── advent2013-day15.t ├── advent2013-day18.t ├── advent2013-day19.t ├── advent2013-day20.t ├── advent2013-day21.t ├── advent2013-day22.t ├── advent2013-day23.t ├── advent2014-day05.t ├── advent2014-day13.t ├── advent2014-day16.t ├── code-blocks-as-sub-args.t ├── deep-recursion-initing-native-array.t ├── diamond.t ├── diamond │ ├── A.rakumod │ ├── B.rakumod │ ├── C.rakumod │ ├── D.rakumod │ └── a.raku ├── error-reporting.t ├── eval-and-threads.t ├── failure-and-callsame.t ├── gather-with-loops.t ├── lazy-bentley-generator.t ├── lexical-array-in-inner-block.t ├── lexicals-and-attributes.t ├── man-or-boy.t ├── method-calls-and-instantiation.t ├── no-indirect-new.t ├── packages.t ├── pair-in-array.t ├── passing-pair-class-to-sub.t ├── precompiled.t ├── real-strings.t ├── role-composition-vs-attribute.t ├── rule-in-class-Str.t ├── say-crash.t ├── sequence.t ├── sequence │ ├── Foo.rakumod │ └── foo.raku ├── substr-after-match-in-gather-in-for.t ├── topic_in_double_loop.t ├── variables-in-do.t └── weird-errors.t ├── packages ├── AandB │ └── lib │ │ ├── A.rakumod │ │ ├── A │ │ ├── A.rakumod │ │ └── B.rakumod │ │ ├── B.rakumod │ │ ├── B │ │ └── Grammar.rakumod │ │ ├── RoleA.rakumod │ │ └── RoleB.rakumod ├── Advent │ └── lib │ │ └── Advent │ │ ├── GrammarProfiler.rakumod │ │ ├── MetaBoundaryAspect.rakumod │ │ └── SingleInheritance.rakumod ├── ArrayInit │ └── lib │ │ └── ArrayInit.rakumod ├── ContainsUnicode │ └── lib │ │ └── ContainsUnicode.rakumod ├── Cool │ └── lib │ │ └── Cool │ │ ├── Beans.rakumod │ │ ├── Cat.rakumod │ │ ├── Cat │ │ └── Goes │ │ │ └── Splat.rakumod │ │ └── Utils.rakumod ├── CurrentDistributionOne │ ├── META6.json │ ├── lib │ │ └── CurrentDistributionOne.rakumod │ └── resources │ │ └── foo.txt ├── CurrentDistributionTwo │ ├── META6.json │ ├── lib │ │ └── CurrentDistributionTwo.rakumod │ └── resources │ │ └── foo.txt ├── Example │ └── lib │ │ └── Example │ │ ├── A.rakumod │ │ ├── B.rakumod │ │ └── C.rakumod ├── Example2 │ └── lib │ │ └── Example2 │ │ ├── A.rakumod │ │ ├── B.rakumod │ │ ├── C.rakumod │ │ ├── D.rakumod │ │ ├── E.rakumod │ │ ├── F.rakumod │ │ ├── G.rakumod │ │ ├── H.rakumod │ │ ├── K.rakumod │ │ ├── N.rakumod │ │ ├── P.rakumod │ │ ├── R.rakumod │ │ ├── S.rakumod │ │ ├── T.rakumod │ │ └── U.rakumod ├── ExportConstant │ └── lib │ │ └── ExportConstant.rakumod ├── Export_Pack │ └── lib │ │ ├── Export_PackA.rakumod │ │ ├── Export_PackB.rakumod │ │ ├── Export_PackC.rakumod │ │ └── Export_PackD.rakumod ├── Exportops │ └── lib │ │ └── Exportops.rakumod ├── Fancy │ └── lib │ │ └── Fancy │ │ └── Utilities.rakumod ├── FooBarBaz │ └── lib │ │ ├── Bar.rakumod │ │ ├── Baz.rakumod │ │ ├── Foo.rakumod │ │ └── FooBar.rakumod ├── HasMain │ └── lib │ │ └── HasMain.rakumod ├── InternArray │ └── lib │ │ ├── InternArrayA.rakumod │ │ └── InternArrayB.rakumod ├── LoadCounter │ └── lib │ │ └── LoadCounter.rakumod ├── LoadFromInside │ └── lib │ │ ├── LoadFromInsideAClass.rakumod │ │ ├── LoadFromInsideAModule.rakumod │ │ └── LoadMe.rakumod ├── OverrideTest │ └── lib │ │ └── OverrideTest.rakumod ├── PM6 │ └── lib │ │ └── PM6.rakumod ├── PackageTest │ └── lib │ │ └── PackageTest.rakumod ├── R3783 │ └── lib │ │ ├── Shadow.pm │ │ └── Shadow.rakumod ├── RAKUDO1413 │ └── lib │ │ └── RAKUDO1413.rakumod ├── README ├── RT112626 │ └── lib │ │ └── RT112626 │ │ ├── Class1.rakumod │ │ ├── Class2.rakumod │ │ ├── Conflict.rakumod │ │ └── Role.rakumod ├── RT115240 │ └── lib │ │ └── RT115240.rakumod ├── RT117117 │ └── lib │ │ └── RT117117 │ │ ├── Backend │ │ ├── AST.rakumod │ │ └── GNUC.rakumod │ │ ├── Backends.rakumod │ │ └── Grammar.rakumod ├── RT122447 │ └── lib │ │ └── RT122447.rakumod ├── RT123276 │ └── lib │ │ ├── RT123276.rakumod │ │ └── RT123276 │ │ └── B │ │ ├── C1.rakumod │ │ └── C2.rakumod ├── RT124162 │ └── lib │ │ └── RT124162.rakumod ├── RT125090 │ └── lib │ │ └── RT125090.rakumod ├── RT125245 │ └── lib │ │ └── RT125245.rakumod ├── RT125715 │ └── lib │ │ └── RT125715.rakumod ├── RT126302 │ └── lib │ │ ├── RT126302.rakumod │ │ └── RT126302 │ │ └── B.rakumod ├── RT126878 │ └── lib │ │ └── RT126878 │ │ ├── NoPrecomp.rakumod │ │ └── Precomp.rakumod ├── RT126904 │ └── lib │ │ └── Woohoo │ │ ├── Foo │ │ ├── Bar.rakumod │ │ └── Baz.rakumod │ │ └── Qux.rakumod ├── RT127176 │ └── lib │ │ └── RT127176.rakumod ├── RT128156 │ └── lib │ │ ├── A.rakumod │ │ ├── B.rakumod │ │ ├── C.rakumod │ │ ├── D.rakumod │ │ └── RT128156 │ │ ├── C.rakumod │ │ ├── Needed.rakumod │ │ ├── One.rakumod │ │ ├── Three.rakumod │ │ ├── Top1.rakumod │ │ ├── Top2.rakumod │ │ └── Two.rakumod ├── RT129215 │ └── lib │ │ └── RT129215.rakumod ├── RT129266 │ └── lib │ │ └── RT129266 │ │ ├── Bar.rakumod │ │ └── Foo.rakumod ├── RT76456 │ └── lib │ │ └── RT76456.rakumod ├── RT76606 │ └── lib │ │ ├── RT76606.rakumod │ │ └── RT76606 │ │ └── a.rakumod ├── RT83354 │ └── lib │ │ ├── RT83354_A.rakumod │ │ └── RT83354_B.rakumod ├── RT84280 │ └── lib │ │ └── RT84280.rakumod ├── RequireAndUse │ └── lib │ │ ├── RequireAndUse1.rakumod │ │ ├── RequireAndUse2.rakumod │ │ └── RequireAndUse3.rakumod ├── Roles │ └── lib │ │ └── GH2613.rakumod ├── S02-names │ └── lib │ │ ├── GH3104_6d.rakumod │ │ ├── Pseudo6c.rakumod │ │ ├── Pseudo6d.rakumod │ │ └── Pseudo6e.rakumod ├── S02-types │ └── lib │ │ ├── Subset6c.rakumod │ │ └── Subset6e.rakumod ├── S06-multi │ └── lib │ │ └── compile-time.rakumod ├── S10-packages │ └── lib │ │ ├── GH2897-A.rakumod │ │ └── GH2897-B.rakumod ├── S11-modules │ └── lib │ │ ├── EmptyClass.rakumod │ │ ├── ExportsEnumDate.rakumod │ │ ├── Foo.rakumod │ │ ├── GH2979-Foo.rakumod │ │ ├── GH2979.rakumod │ │ ├── GH2983.rakumod │ │ ├── GlobalInner.rakumod │ │ ├── GlobalOuter.rakumod │ │ ├── InnerClass.rakumod │ │ ├── InnerModule.rakumod │ │ ├── Main.rakumod │ │ ├── Main │ │ └── Nested.rakumod │ │ ├── MainLoadsNestedFirst.rakumod │ │ ├── MainLoadsNestedFirst │ │ └── Nested.rakumod │ │ ├── MainLoadsNestedInside.rakumod │ │ ├── MainLoadsNestedInside │ │ └── Nested.rakumod │ │ ├── Module_6c.rakumod │ │ ├── Module_6d.rakumod │ │ ├── Module_6e.rakumod │ │ ├── NoModule.rakumod │ │ ├── NoPrecompilation.rakumod │ │ ├── OuterModule.rakumod │ │ ├── RuntimeCreatedPackage.rakumod │ │ └── SetConst.rakumod ├── S12-meta │ └── lib │ │ ├── Declare.rakumod │ │ ├── DeclareBad.rakumod │ │ ├── InvalidDirective.rakumod │ │ ├── MultiDeclare.rakumod │ │ ├── Supersede1.rakumod │ │ ├── Supersede2.rakumod │ │ ├── SupersedeBad.rakumod │ │ └── TestHOW.rakumod ├── S14-roles │ └── lib │ │ ├── Ver6c.rakumod │ │ └── Ver6e.rakumod ├── Test-Helpers │ ├── META6.json │ └── lib │ │ └── Test │ │ ├── Assuming.rakumod │ │ ├── Compile.rakumod │ │ ├── Idempotence.rakumod │ │ ├── Iterator.rakumod │ │ ├── Misc.rakumod │ │ ├── Tap.rakumod │ │ └── Util.rakumod └── UseTest │ └── lib │ └── UseTest.rakumod ├── spectest.data ├── super-fudger.raku ├── t ├── 01-implname.in ├── 01-implname.out_impl-1 ├── 01-implname.out_impl-1.backend ├── 01-implname.out_impl-2 ├── 02-version.in ├── 02-version.out_v6.0.0 ├── 02-version.out_v6.0.3 ├── 02-version.out_v6.1.0 ├── 03-count.in ├── 03-count.out_v6.0.0 ├── 04-combinations.in ├── 04-combinations.out_impl.1 ├── 04-combinations.out_impl.2 ├── 05-skip.in ├── 05-skip.out_impl-1 ├── 06-todo.in ├── 06-todo.out_impl-1 ├── 07-register_function.in ├── 07-register_function.out_impl-1 ├── README ├── fudge.t ├── fudgeandrun.t └── test-util │ └── 01-is-eqv.t ├── test_summary └── tools └── spec-review.raku /.gitignore: -------------------------------------------------------------------------------- 1 | *.rakudo 2 | *.rakudo.jvm 3 | *.rakudo.parrot 4 | *.rakudo.moar 5 | *.niecza 6 | .precomp 7 | S32-io/server-ready-flag 8 | -------------------------------------------------------------------------------- /3rdparty/wikipedia/Hangul.txt: -------------------------------------------------------------------------------- 1 | 오스트레일리아청개구리는 청개구리치고 덩치가 포동포동하고 신장도 큰 종으로서, 약 11.5 센티미터까지 2 | 자랄 수 있고 암컷이 수컷보다 약간 더 크다. 눈 위에 특유의 지방질 둔덕이 있으며 측두샘은 다소 크다. 3 | 홍채는 금색이고 가로로 찢어져 있는데, 이는 오스트레일리아청개구리속 전체의 특징이다. 고실막(인간의 4 | 고막과 유사한 피부막)은 눈 바로 뒤에 있다. 사지는 짧고 강인하며 발가락 끝에는 커다란 부착반이 있어 5 | 면 위를 기어올라갈 수 있다. 앞발가락은 3분의 1 정도가 물갈퀴로 덮여 있고 뒷발가락은 3분의 4 정도가 6 | 물갈퀴로 덮여 있다. 등면 색깔은 온도와 주위 환경에 따라 갈색 또는 회색에서 에메랄드빛 밝은 녹색까지 7 | 변하고, 작고 불규칙한 흰 반점이 찍혀 있는 경우가 간간이 있다. 수컷은 목 아래에 주름진 회색 8 | 울음주머니가 있는 반면 암컷은 같은 부위가 희고 매끄럽다. 배면 색깔은 암수 모두 크림색 흰색이며 9 | 질감은 거칠다. -------------------------------------------------------------------------------- /3rdparty/wikipedia/LICENSE: -------------------------------------------------------------------------------- 1 | # Listing of the dates and URL's of the text contained in this project. 2 | # All text under the Creative Commons Share Alike 3.0 3 | # https://creativecommons.org/licenses/by-sa/3.0/ 4 | 5 | Arabic 2017-03-24 https://fa.wikipedia.org/wiki/%D9%BE%D8%B1%D9%88%DB%8C%D9%86_%D8%A7%D8%B9%D8%AA%D8%B5%D8%A7%D9%85%DB%8C 6 | Hangul 2017-03-24 https://ko.wikipedia.org/wiki/%EC%98%A4%EC%8A%A4%ED%8A%B8%EB%A0%88%EC%9D%BC%EB%A6%AC%EC%95%84%EC%B2%AD%EA%B0%9C%EA%B5%AC%EB%A6%AC -------------------------------------------------------------------------------- /6.c/S02-names/SETTING-6c.t: -------------------------------------------------------------------------------- 1 | # SETTING is a revision-specific namespace. 2 | use v6.c; 3 | use Test; 4 | 5 | plan 6; 6 | 7 | sub not($x) { $x } #OK 8 | my $setting = 'SETTING'; 9 | ok &SETTING::not(False), 'SETTING:: works'; 10 | ok &::($setting)::not.(False), '::("SETTING") works'; 11 | 12 | #?rakudo 4 skip "NYI" 13 | { 14 | ok EVAL('&SETTING::not(False)'), 'SETTING finds eval context'; 15 | ok EVAL('&::($setting)::not(False)'), '::("SETTING") finds eval context'; 16 | my $f = EVAL('-> $fn { $fn(); }'); 17 | ok $f({ &CALLER::SETTING::not(False) }), 'CALLER::SETTING works'; 18 | ok $f({ &CALLER::($setting)::not(False) }), 'CALLER::SETTING works (ind)'; 19 | } 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /APPENDICES/A02-some-day-maybe/concreteness.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # The tests in this file ensure certain constructs die with a decent error 4 | # instead of hanging or crashing by spilling compiler guts. 5 | # 6 | # Since there's yet no existing behaviour for some of such combinations, 7 | # X::Parameter::InvalidConcreteness is thrown. 8 | # This APPENDIX test file is for such tests. 9 | 10 | plan 1; 11 | 12 | throws-like 「Supply.skip」, X::Parameter::InvalidConcreteness, 'Supply:U.skip'; 13 | 14 | # vim: expandtab shiftwidth=4 15 | -------------------------------------------------------------------------------- /APPENDICES/A02-some-day-maybe/io-cathandle.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | my @meths = < 4 | flush out-buffer print printf print-nl put say write 5 | WRITE READ EOF 6 | >; # nl-out 7 | plan 2 + @meths; 8 | 9 | throws-like { IO::CatHandle.new."$_"() }, X::NYI, $_ for @meths; 10 | 11 | throws-like { IO::CatHandle.new.slurp-rest }, X::Obsolete, 12 | :old, :replacement, :when('with IO::CatHandle'), 13 | '.slurp-rest'; 14 | 15 | is IO::CatHandle.new.Str, '', '.Str on closed handle'; 16 | 17 | # vim: expandtab shiftwidth=4 18 | -------------------------------------------------------------------------------- /MISC/bug-coverage-6.d.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Util; 4 | 5 | # This file is for random bugs that don't really fit well in other places. 6 | # Feel free to move the tests to more appropriate places. 7 | 8 | plan 1; 9 | 10 | throws-like 「 11 | sub foo { whenever Promise.in(2) { say ‘hello’ } }; react foo 12 | 」, X::Comp::WheneverOutOfScope, 'whenever not in lexical scope of react throws'; 13 | 14 | # vim: expandtab shiftwidth=4 15 | -------------------------------------------------------------------------------- /S01-perl-5-integration/README: -------------------------------------------------------------------------------- 1 | This directory features tests for Perl embedding. 2 | -------------------------------------------------------------------------------- /S01-perl-5-integration/class.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan(3); 4 | 5 | unless (try { EVAL("1", :lang) }) { 6 | skip-rest; 7 | exit; 8 | } 9 | 10 | { 11 | lives-ok { 12 | EVAL q| 13 | use Digest::MD5:from; 14 | my $d = Digest::MD5.new; 15 | #?rakudo skip "" 16 | { 17 | is $d.isa(Digest::MD5), 1, "Correct isa"; 18 | } 19 | $d.add('foo'.encode('UTF-8')); 20 | is $d.hexdigest, 'acbd18db4cc2f85cedef654fccc4a4d8'; 21 | | 22 | or die $!; 23 | }, "CLASS:from.new"; 24 | } 25 | 26 | # vim: expandtab shiftwidth=4 27 | -------------------------------------------------------------------------------- /S01-perl-5-integration/exception_handling.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | 4 | BEGIN { 5 | plan 3; 6 | unless (try { EVAL("1", :lang) }) { 7 | skip-rest('no Perl support'); exit; 8 | } 9 | } 10 | 11 | use Carp:from; 12 | 13 | my $err; 14 | lives-ok({ try { Carp.croak() }; $err = $! }, "Perl exception (die) caught"); 15 | like($err.Str, rx/Carp/, "Exception is propagated to Raku land"); 16 | 17 | EVAL(q[ 18 | package Foo; 19 | 20 | sub new { 21 | bless {}, __PACKAGE__; 22 | } 23 | 24 | sub error { 25 | my $error = Foo->new; 26 | die $error; 27 | } 28 | 29 | sub test { "1" } 30 | ], :lang); 31 | 32 | my $foo = EVAL("Foo->new",:lang); 33 | try { $foo.error }; 34 | lives-ok( { 35 | my $err = $!; 36 | $err.payload.test; 37 | }, "Accessing Perl method doesn't die"); 38 | 39 | # vim: expandtab shiftwidth=4 40 | -------------------------------------------------------------------------------- /S01-perl-5-integration/import.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 3; 3 | 4 | =begin pod 5 | 6 | P5 module import test 7 | 8 | =end pod 9 | 10 | unless (try { EVAL("1", :lang) }) { 11 | skip-rest; 12 | exit; 13 | } 14 | 15 | eval-lives-ok(q[ 16 | use Text::Wrap:from 'wrap'; 17 | is(Text::Wrap::wrap('foo', 'bar', 'baz'), 'foobaz', "import p5 module"); 18 | is(wrap('foo', 'bar', 'baz'), 'foobaz', "import p5 module"); 19 | ],"parse :from syntax"); 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /S01-perl-5-integration/isms.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 2; 4 | 5 | { 6 | my $a = 42; 7 | lives-ok { use isms ; $a=~$a }, "does =~ survive?"; 8 | is-deeply $a, "42", "did it actually do the assignment?"; 9 | } 10 | 11 | # vim: expandtab shiftwidth=4 12 | -------------------------------------------------------------------------------- /S01-perl-5-integration/return.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan(2); 4 | 5 | unless (try { EVAL("1", :lang) }) { 6 | skip-rest; 7 | exit; 8 | } 9 | 10 | EVAL q<<< 11 | 12 | use Digest::MD5:from ; 13 | 14 | sub get_dmd5 { 15 | my $ctx = Digest::MD5.new; 16 | return($ctx); 17 | } 18 | 19 | { 20 | is( md5_hex('test'), '098f6bcd4621d373cade4e832627b4f6', 'Perl function exported' ); 21 | } 22 | 23 | { 24 | my $ctx = get_dmd5(); 25 | $ctx.add('test'); 26 | is( $ctx.hexdigest, '098f6bcd4621d373cade4e832627b4f6', 'XS return' ); 27 | } 28 | 29 | >>>; 30 | 31 | # vim: expandtab shiftwidth=4 32 | -------------------------------------------------------------------------------- /S01-perl-5-integration/subs.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 2; 3 | 4 | unless (try { EVAL("1", :lang) }) { 5 | skip-rest; 6 | exit; 7 | } 8 | 9 | my &foo := EVAL('sub {432}',:lang); 10 | is foo(),432,"calling subs works"; 11 | 12 | my $foo = EVAL('sub {432}',:lang); 13 | is $foo(),432,"calling subs stored in variables works"; 14 | 15 | # vim: expandtab shiftwidth=4 16 | -------------------------------------------------------------------------------- /S02-lexical-conventions/bom.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | ok 1, 'can parse a file starting with a byte-order mark'; 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /S02-lexical-conventions/finish-pod.t: -------------------------------------------------------------------------------- 1 | # Test various forms of comments 2 | 3 | use Test; 4 | 5 | plan 2; 6 | 7 | # L 8 | 9 | ok 1, "Before the =finish Block"; 10 | 11 | is $=finish,q:to/TEXT/, 'can read the lines after =finish'; 12 | flunk "=finish cannot work properly"; 13 | 14 | # vim: expandtab shiftwidth=4 15 | TEXT 16 | 17 | =finish 18 | flunk "=finish cannot work properly"; 19 | 20 | # vim: expandtab shiftwidth=4 21 | -------------------------------------------------------------------------------- /S02-lexical-conventions/one-pass-parsing.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 5; 4 | 5 | # L 6 | 7 | lives-ok { EVAL 'regex { <[ } > ]> }; 1' }, 8 | "can parse non-backslashed curly and right bracket in cclass"; 9 | 10 | # https://github.com/Raku/old-issue-tracker/issues/1753 11 | { 12 | lives-ok { EVAL 'sub if() { "#foo" }; say if();' }, 13 | "Can call sub if()"; 14 | dies-ok { EVAL 'sub if() { "#foo" }; say if ;' }, 15 | "Calling sub if without parens parsefails due to no-arg say"; 16 | lives-ok { EVAL 'sub if() { "#foo" }; say if;' }, 17 | "Calling sub if okay parens as long as not followed by whitespace"; 18 | dies-ok { EVAL 'say "OK" if+1' }, 19 | "Using keyword if fails if not followed by whitespace"; 20 | } 21 | 22 | # vim: expandtab shiftwidth=4 23 | -------------------------------------------------------------------------------- /S02-lexical-conventions/pod-in-multi-line-exprs.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | =begin kwid 4 | 5 | Parse problem when pod inside a multi-line hash-def expression. 6 | 7 | =end kwid 8 | 9 | plan 3; 10 | 11 | my $mysub = { 12 | 13 | 1; 14 | 15 | =begin pod 16 | 17 | =end pod 18 | 19 | }; 20 | 21 | is $mysub(), 1, "anon sub def parses when pod block is within it"; 22 | 23 | my $myhash = { 24 | 25 | 'baz' => 3, 26 | 27 | =begin pod 28 | 29 | =end pod 30 | 31 | }; 32 | 33 | is $myhash, 3, "anon hash def parses when pod block is within it"; 34 | 35 | my $myarray = [ 36 | 37 | 4, 38 | 39 | =begin pod 40 | 41 | =end pod 42 | 43 | ]; 44 | 45 | is $myarray[0], 4, "anon array def parses when pod block is within it"; 46 | 47 | # vim: expandtab shiftwidth=4 48 | -------------------------------------------------------------------------------- /S02-lists/indexing.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Util; 4 | 5 | plan 4; 6 | 7 | # https://github.com/Raku/old-issue-tracker/issues/3462 8 | is (42)[*/2], 42, 'Indexing half way into one element list'; 9 | 10 | # http://irclog.perlgeek.de/perl6/2015-01-23#i_9994456 11 | fails-like 「(my @)[*-1]」, X::OutOfRange, 12 | 'Out of range index returns a Failure object'; 13 | 14 | # https://github.com/Raku/old-issue-tracker/issues/4695 15 | fails-like 「[4, 8, 15, 16, 23][* - 42]」, X::OutOfRange; 16 | 17 | # https://irclog.perlgeek.de/perl6-dev/2016-10-28#i_13482635 18 | cmp-ok ()[0], '===', Nil, '()[0] gives Nil'; 19 | 20 | # vim: expandtab shiftwidth=4 21 | -------------------------------------------------------------------------------- /S02-literals/hex_chars.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | #L 6 | { 7 | my @unicode = 8 | 'a', "\x61", 9 | 'æ', "\xE6", 10 | '喃', "\x5583", 11 | '𨮁', "\x28B81", 12 | ; 13 | 14 | for @unicode -> $literal, $codepoint { 15 | is( 16 | $codepoint, 17 | $literal, 18 | 'Does a character codepoint (\x..) evaluate to the same thing as its literal?' 19 | ); 20 | } 21 | } 22 | 23 | 24 | # vim: expandtab shiftwidth=4 25 | -------------------------------------------------------------------------------- /S02-literals/subscript.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 2; 4 | 5 | { # from t/03-operator.t, as noted by afbach on #perl6, 2005-03-06 6 | my @oldval = (5, 8, 12); 7 | my @newval1 = (17, 15, 14); # all greater 8 | my @newval2 = (15, 7, 20); # some less some greater 9 | lives-ok({ all(@newval2) < any(@oldval); all(@newval1) > all(@oldval) }, "parses correctly, second statement is true"); 10 | 11 | my %hash = ("foo", "bar"); 12 | throws-like { EVAL '%hash ; 1'}, 13 | X::Comp, 14 | '%hash \s+ doesnt parse'; 15 | }; 16 | 17 | # vim: expandtab shiftwidth=4 18 | -------------------------------------------------------------------------------- /S02-magicals/78258.t: -------------------------------------------------------------------------------- 1 | use lib $?FILE.IO.parent; 2 | 3 | use UsedEnv; # contains plan 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /S02-magicals/GROUP.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | { 6 | # https://github.com/Raku/old-issue-tracker/issues/5308 7 | lives-ok { $*GROUP.gist; $*GROUP.WHAT.gist; }, 8 | '.WHAT on $*GROUP after using $*GROUP values lives'; 9 | } 10 | 11 | # vim: expandtab shiftwidth=4 12 | -------------------------------------------------------------------------------- /S02-magicals/USER.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | { 6 | # https://github.com/Raku/old-issue-tracker/issues/5308 7 | lives-ok { $*USER.gist; $*USER.WHAT.gist; }, 8 | '.WHAT on $*USER after using $*USER values lives'; 9 | } 10 | 11 | # vim: expandtab shiftwidth=4 12 | -------------------------------------------------------------------------------- /S02-magicals/UsedEnv.rakumod: -------------------------------------------------------------------------------- 1 | module UsedEnv { 2 | use Test; 3 | plan 1; 4 | # https://github.com/Raku/old-issue-tracker/issues/2213 5 | ok (%*ENV:exists or %*ENV:exists), "env exists in use (RT #78258)"; 6 | } 7 | 8 | 9 | # vim: expandtab shiftwidth=4 10 | -------------------------------------------------------------------------------- /S02-magicals/file_line.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 2; 4 | 5 | # L 6 | is($?LINE, 6, '$?LINE works'); 7 | 8 | # L 9 | # try to be robust for implementations that use Win32 file paths, or 10 | # absolute paths, or whatever 11 | ok($?FILE ~~ rx/'S02-magicals'<[\/\\]>'file_line.t'/, '$?FILE works'); 12 | 13 | 14 | # vim: expandtab shiftwidth=4 15 | -------------------------------------------------------------------------------- /S02-magicals/pid.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Util; 4 | 5 | =begin description 6 | 7 | Test that C< $*PID > in this process is different from 8 | C< $*PID > in the child process. 9 | L/> 10 | 11 | =end description 12 | 13 | plan 2; 14 | 15 | is_run 'say $*PID', 16 | { 17 | out => -> $p { $p > 0 && $p != $*PID }, 18 | err => '', 19 | status => 0, 20 | }, 'my $*PID is different from a child $*PID'; 21 | 22 | throws-like '$*PID = 42', X::Assignment::RO; 23 | 24 | # vim: expandtab shiftwidth=4 25 | -------------------------------------------------------------------------------- /S02-magicals/subname.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | 6 | # L object/current routine name> 7 | # L 8 | sub foo { return &?ROUTINE.package.^name ~ '::' ~ &?ROUTINE.name } 9 | is(foo(), 'GLOBAL::foo', 'got the right routine name in the default package'); 10 | 11 | { 12 | # This testcase might be really redundant 13 | package Bar { 14 | sub bar { return &?ROUTINE.package.^name ~ '::' ~ &?ROUTINE.name } 15 | is(bar(), 'Bar::bar', 'got the right routine name outside the default package'); 16 | } 17 | } 18 | 19 | my $bar = sub { &?ROUTINE.name }; 20 | is($bar(), '', 'got an empty string for an anon block'); 21 | 22 | throws-like { EVAL 'my $baz = try { &?ROUTINE.name };' }, 23 | X::Undeclared::Symbols, 24 | "&?ROUTINE not available outside of a routine"; 25 | 26 | # vim: expandtab shiftwidth=4 27 | -------------------------------------------------------------------------------- /S02-one-pass-parsing/misc.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Util; 4 | 5 | plan 1; 6 | 7 | # https://github.com/Raku/old-issue-tracker/issues/3692 8 | { 9 | is_run q[say $\\], { :1status, err => /'Confused'/ }, 10 | 'spurious backslash at end of file error must ask for semicolon'; 11 | } 12 | 13 | # vim: expandtab shiftwidth=4 14 | -------------------------------------------------------------------------------- /S02-types/built-in.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | # various tests for built-in types 6 | # L 7 | 8 | # https://github.com/Raku/old-issue-tracker/issues/3413 9 | # TODO: typed exception instead of testing for specific error message 10 | { 11 | throws-like { 12 | my $foo = ObjAt.new(:val("test")); 13 | $foo ~~ /"foo"/; 14 | }, 15 | Exception, 16 | message => / 'Too few positionals passed' .+ 'expected 2 arguments but got 1' /, 17 | 'no segfault in ObjAt initialization when passing bogus named arguments'; 18 | } 19 | 20 | # vim: expandtab shiftwidth=4 21 | -------------------------------------------------------------------------------- /S02-types/fatrat.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | #L and C Types/For applications that really need arbitrary precision> 6 | { 7 | my $fatty := FatRat.new(9,10); 8 | isa-ok( $fatty, FatRat); 9 | } 10 | 11 | # vim: expandtab shiftwidth=4 12 | -------------------------------------------------------------------------------- /S02-types/parsing-bool.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | # L, short-circuit inclusive or"> 6 | # L 7 | 8 | is (try { 42 or Bool::False }), 42, "Bool::False as RHS"; 9 | is (try { Bool::False or 42 }), 42, "Bool::False as LHS"; 10 | 11 | is (try { 42 or False }), 42, "False as RHS"; 12 | is (try { False or 42 }), 42, "False as LHS"; 13 | 14 | # vim: expandtab shiftwidth=4 15 | -------------------------------------------------------------------------------- /S02-types/stash.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | #L 6 | 7 | # https://github.com/Raku/old-issue-tracker/issues/3137 8 | { 9 | sub S (Stash $s) { $s.WHAT.raku }; 10 | is S(Stash.new), 'Stash', 'Stash.new creates Stash, not a Hash'; 11 | } 12 | 13 | # vim: expandtab shiftwidth=4 14 | -------------------------------------------------------------------------------- /S03-operators/custom.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | # https://github.com/Raku/old-issue-tracker/issues/2697 6 | { 7 | enum A ; 8 | multi infix:<< - >>(e1, e2) { return "AWW" }; 9 | is e1 - e2, "AWW", "can use <<>> for infix defs"; 10 | } 11 | 12 | # vim: expandtab shiftwidth=4 13 | -------------------------------------------------------------------------------- /S03-operators/infixed-function.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 5; 4 | 5 | is 3 [&atan2] 4, atan2(3, 4), "3 [&atan2] 4 == atan2(3, 4)"; 6 | is 3 R[&atan2] 4, atan2(4, 3), "3 R[&atan2] 4 == atan2(4, 3)"; 7 | is 3 R[&atan2] 4, atan2(4, 3), "... and you can do it twice"; 8 | 9 | is "%10s" [&sprintf] "step", " step", "[&sprintf] works"; 10 | is ("%04x" X[&sprintf] 7, 11, 42), "0007 000b 002a", "X[&sprint] works"; 11 | 12 | # vim: expandtab shiftwidth=4 13 | -------------------------------------------------------------------------------- /S03-operators/names.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 7; 3 | 4 | is &infix:<+>(3, 8), 11, 'Can refer to &infix:<+>'; 5 | is infix:<+>(3, 8), 11, 'Can refer to infix:<+>'; 6 | 7 | is &infix:<->(3, 8), -5, 'Can refer to &infix:<->'; 8 | is infix:<->(3, 8), -5, 'Can refer to infix:<->'; 9 | 10 | is &infix:(3, 4), Order::Less, 'Can refer to &infix:'; 11 | 12 | #?rakudo.jvm todo 'Something wrong with stringification of &infix:<+> et al. -- only Sub+{is-pure} is reported' 13 | ok ~&infix:<+> ~~ /infix/, 'String value of &infix:<+> contains "infix"'; 14 | ok ~&infix:<+> ~~ /\+/, 'String value of &infix:<+> contains "+"'; 15 | 16 | # vim: expandtab shiftwidth=4 17 | -------------------------------------------------------------------------------- /S03-operators/scalar-assign.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | # old: L 6 | # L 7 | 8 | { 9 | my $x = 15; 10 | my $y = 1; 11 | ($x = $y) = 5; 12 | is $x, 5, 'order of assignment respected (1)'; 13 | is $y, 1, 'order of assignment respected (2)'; 14 | $x = $y = 7; 15 | is $y, 7, 'assignment is right-associative'; 16 | } 17 | 18 | # From p5 "perldoc perlop" 19 | { 20 | my $x = 1; 21 | ($x += 2) *= 3; 22 | is $x, 9, 'lvalue expressions are only evaluated once'; 23 | } 24 | 25 | 26 | # vim: expandtab shiftwidth=4 27 | -------------------------------------------------------------------------------- /S03-operators/so.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 15; 3 | 4 | # L 5 | 6 | ok(so 1, "so 1 is true"); 7 | ok(so -1, "so -1 is true"); 8 | ok(not so 0, "not so 0 is true"); 9 | ok(so sub{}, 'so sub{} is true'); 10 | ok(so "x", 'so "x" is true'); 11 | 12 | my $a = 1; ok(so $a, 'so $true_var is true'); 13 | my $b = 0; ok(!(so $b), 'so $false_var is not true'); 14 | 15 | ok( so(so 42), "so(so 42) is true"); 16 | ok(not so(so 0), "so(so 0) is false"); 17 | 18 | ok(so Bool::True, "'Bool::True' is true"); 19 | ok Bool.so === False, 'Bool.so returns false'; 20 | ok(so True, "'True' is true"); 21 | 22 | is (so($b) + 1), ((so $b) + 1), 'so($b) is (so $b)'; 23 | 24 | ok (so my $x = 5), 'so + declaration'; 25 | is $x, 5, 'assignment after so worked'; 26 | 27 | # vim: expandtab shiftwidth=4 28 | -------------------------------------------------------------------------------- /S03-operators/spaceship-and-containers.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 6; 4 | #L operator> 5 | 6 | my %h = ("a" => 1, "b" => 2); 7 | ok(%h{"a"} < %h{"b"}, 'comparing hash values'); 8 | ok(%h{"a"} <= %h{"b"}, 'comparing hash values'); 9 | is(%h{"a"} <=> %h{"b"}, Order::Less, 'comparing hash values'); 10 | 11 | my @a = (1, 2); 12 | ok(@a[0] < @a[1], 'comparing array values'); 13 | ok(@a[0] <= @a[1], 'comparing array values'); 14 | is(@a[0] <=> @a[1], Order::Less, 'comparing array values'); 15 | 16 | # vim: expandtab shiftwidth=4 17 | -------------------------------------------------------------------------------- /S03-operators/subscript-vs-lt.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | =begin pod 4 | 5 | Infix comparison operators L 6 | 7 | =end pod 8 | 9 | 10 | plan 4; 11 | 12 | # infix less-than requires whitespace; otherwise it's interpreted as 13 | # a <...> hash subscript 14 | 15 | eval-lives-ok "1 <2", "infix less-than (<) requires whitespace before."; 16 | eval-lives-ok "1 < 2" , "infix less-than (<) requires whitespace before."; 17 | throws-like "1< 2", Exception, "infix less-than (<) requires whitespace before, so this is a parse error."; 18 | throws-like "1<2", Exception, "infix less-than (<) requires whitespace before, so this is a parse error."; 19 | 20 | # vim: expandtab shiftwidth=4 21 | -------------------------------------------------------------------------------- /S03-smartmatch/any-any.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 8; 3 | 4 | #L 5 | { 6 | class Smartmatch::ObjTest {} 7 | my $a = Smartmatch::ObjTest.new; 8 | my $b = Smartmatch::ObjTest.new; 9 | ok ($a ~~ $a), 'Any ~~ Any (+)'; 10 | ok !($a !~~ $a), 'Any !~~ Any (-)'; 11 | ok !($a ~~ $b), 'Any ~~ Any (-)'; 12 | ok ($a !~~ $b), 'Any !~~ Any (+)'; 13 | } 14 | 15 | 16 | { 17 | $_ = 42; 18 | my $x; 19 | 'abc' ~~ ($x = $_); 20 | is $x, 'abc', '~~ sets $_ to the LHS'; 21 | is $_, 42, 'original $_ restored'; 22 | 'defg' !~~ ($x = $_); 23 | is $x, 'defg', '!~~ sets $_ to the LHS'; 24 | is $_, 42, 'original $_ restored'; 25 | 'defg' !~~ ($x = $_); 26 | } 27 | 28 | # vim: expandtab shiftwidth=4 29 | -------------------------------------------------------------------------------- /S03-smartmatch/any-bool.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 8; 3 | 4 | #L 5 | 6 | { 7 | sub is-true() { True }; 8 | sub is-false() { False }; 9 | is-deeply 0 ~~ is-true(), True, '~~ non-syntactic True'; 10 | is-deeply 'a' ~~ is-true(), True, '~~ non-syntactic True'; 11 | is-deeply 0 ~~ is-false(), False, '~~ non-syntactic True'; 12 | is-deeply 'a' ~~ is-false(), False, '~~ non-syntactic True'; 13 | } 14 | 15 | { 16 | is-deeply 0 ~~ .so, False, 'boolean truth'; 17 | is-deeply 'a' ~~ .so, True, 'boolean truth'; 18 | is-deeply 0 ~~ .not, True, 'boolean truth'; 19 | is-deeply 'a' ~~ .not, False, 'boolean truth'; 20 | } 21 | 22 | # vim: expandtab shiftwidth=4 23 | -------------------------------------------------------------------------------- /S03-smartmatch/any-complex.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 12; 3 | 4 | { 5 | ok (1 + 2i) ~~ (1 + 2i), 'Complex ~~ Complex (+)'; 6 | ok !((1 + 2i) ~~ (1 + 1i)), 'Complex ~~ Complex (-)'; 7 | ok !((1 + 2i) ~~ (2 + 2i)), 'Complex ~~ Complex (-)'; 8 | ok !((1 + 2i) !~~ (1 + 2i)), 'Complex !~~ Complex (-)'; 9 | ok (1 + 2i) !~~ (1 + 1i), 'Complex !~~ Complex (+)'; 10 | ok (1 + 2i) !~~ (2 + 2i), 'Complex !~~ Complex (+)'; 11 | ok 3 ~~ (3 + 0i), 'Num ~~ Complex (+)'; 12 | ok !(2 ~~ (3 + 0i)), 'Num ~~ Complex (-)'; 13 | ok !(3 ~~ (3 + 1i)), 'Num ~~ Complex (-)'; 14 | ok !(3 !~~ (3 + 0i)), 'Num !~~ Complex (-)'; 15 | ok (2 !~~ (3 + 0i)), 'Num !~~ Complex (+)'; 16 | ok (3 !~~ (3 + 1i)), 'Num !~~ Complex (+)'; 17 | } 18 | 19 | # vim: expandtab shiftwidth=4 20 | -------------------------------------------------------------------------------- /S03-smartmatch/any-hash-pair.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 7; 3 | 4 | #L 5 | { 6 | my %a = (a => 1, b => 'foo', c => Mu); 7 | ok (%a ~~ b => 'foo'), '%hash ~~ Pair (Str, +)'; 8 | ok !(%a ~~ b => 'ugh'), '%hash ~~ Pair (Str, -)'; 9 | ok (%a ~~ a => 1.0), '%hash ~~ Pair (Num, +)'; 10 | ok (%a ~~ :b), '%hash ~~ Colonpair'; 11 | ok (%a ~~ c => !*.defined), '%hash ~~ Pair (!*.defined, Mu)'; 12 | ok (%a ~~ d => !*.defined), '%hash ~~ Pair (!*.defined, Nil)'; 13 | ok !(%a ~~ a => 'foo'), '%hash ~~ Pair (key and val not paired)'; 14 | } 15 | 16 | # vim: expandtab shiftwidth=4 17 | -------------------------------------------------------------------------------- /S03-smartmatch/any-method.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 4; 3 | 4 | { 5 | nok 'ab' ~~ .uc, 'smart-match happens after method calls on $_ 1'; 6 | ok 'AA' ~~ .uc, 'smart-match happens after method calls on $_ 2'; 7 | } 8 | 9 | { 10 | nok 'ab' ~~ .substr(1), 'method call with args 1'; 11 | ok 'ab' ~~ .substr(0), 'method call with args 2'; 12 | } 13 | 14 | # vim: expandtab shiftwidth=4 15 | -------------------------------------------------------------------------------- /S03-smartmatch/any-str.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 5; 3 | 4 | #L 5 | { 6 | ok(!("foo" !~~ "foo"), "!(foo ne foo)"); 7 | ok(("bar" !~~ "foo"), "bar ne foo)"); 8 | ok (4 ~~ '4'), 'string equality'; 9 | ok !(4 !~~ '4'), 'negated string equality'; 10 | ok !(Mu ~~ ''), 'Mu !~~ ""'; 11 | } 12 | 13 | # vim: expandtab shiftwidth=4 14 | -------------------------------------------------------------------------------- /S03-smartmatch/any-sub.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 8; 3 | 4 | #L 5 | { 6 | my $t = sub { Bool::True }; 7 | my $f = sub { Bool::False }; 8 | my $mul = sub ($x) { $x * 2 }; 9 | my $sub = sub ($x) { $x - 2 }; 10 | 11 | ok ($t ~~ .()), '~~ .() sub call truth (+)'; 12 | ok !($f ~~ .()), '~~ .() sub call truth (-)'; 13 | ok ('anything' ~~ $t), '~~ sub call truth (+)'; 14 | ok !('anything' ~~ $f), '~~ sub call truth (-)'; 15 | ok (2 ~~ $mul), '~~ sub call truth (+,1)'; 16 | ok !(0 ~~ $mul), '~~ sub call truth (-,1)'; 17 | ok !(2 ~~ $sub), '~~ sub call truth (+,2)'; 18 | ok (0 ~~ $sub), '~~ sub call truth (-,2)'; 19 | } 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /S03-smartmatch/array-hash.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 6; 3 | 4 | #L 5 | # https://github.com/Raku/old-issue-tracker/issues/3801 6 | { 7 | my %h = (a => 'b', c => Mu); 8 | 9 | ok (['a'] ~~ %h), 'Array ~~ Hash (exists and True)'; 10 | ok (['c'] ~~ %h), 'Array ~~ Hash (exists but Mu)'; 11 | ok ([] ~~ %h), 'Array ~~ Hash (both exist)'; 12 | ok ([] ~~ %h), 'Array ~~ Hash (one exists)'; 13 | # note that ?any() evaluates to False 14 | ok !( () ~~ %h), 'Array ~~ Hash (empty list)'; 15 | ok !(['e'] ~~ %h), 'Array ~~ Hash (not exists)'; 16 | 17 | } 18 | 19 | # vim: expandtab shiftwidth=4 20 | -------------------------------------------------------------------------------- /S03-smartmatch/array-map.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 6; 3 | 4 | { 5 | my %h is Map = (a => 'b', c => Mu); 6 | 7 | ok (['a'] ~~ %h), 'Array ~~ Map (exists and True)'; 8 | ok (['c'] ~~ %h), 'Array ~~ Map (exists but Mu)'; 9 | ok ([] ~~ %h), 'Array ~~ Map (both exist)'; 10 | ok ([] ~~ %h), 'Array ~~ Map (one exists)'; 11 | # note that ?any() evaluates to False 12 | ok !( () ~~ %h), 'Array ~~ Map (empty list)'; 13 | ok !(['e'] ~~ %h), 'Array ~~ Map (not exists)'; 14 | 15 | } 16 | 17 | # vim: expandtab shiftwidth=4 18 | -------------------------------------------------------------------------------- /S03-smartmatch/regex-hash.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 4; 3 | 4 | #L 5 | { 6 | my %h = (moep => 'foo', bar => 'baz'); 7 | ok (/oep/ ~~ %h), 'Regex ~~ Hash (+,1)'; 8 | ok (/bar/ ~~ %h), 'Regex ~~ Hash (+,2)'; 9 | ok !(/ugh/ ~~ %h), 'Regex ~~ Hash (-,1)'; 10 | ok !(/foo/ ~~ %h), 'Regex ~~ Hash (-,value)'; 11 | } 12 | 13 | # vim: expandtab shiftwidth=4 14 | -------------------------------------------------------------------------------- /S03-smartmatch/scalar-hash.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 3; 3 | 4 | #L 5 | { 6 | my %h = (moep => 'foo', bar => Mu); 7 | ok ('moep' ~~ %h), 'Cool ~~ Hash (+, True)'; 8 | ok ('bar' ~~ %h), 'Cool ~~ Hash (+, False)'; 9 | ok !('foo' ~~ %h), 'Cool ~~ Hash (-)'; 10 | } 11 | 12 | # vim: expandtab shiftwidth=4 13 | -------------------------------------------------------------------------------- /S04-exception-handlers/top-level.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | sub foo { die }; 6 | foo; 7 | 8 | CATCH { 9 | when * { 10 | pass 'Top-level handler caught exception' 11 | } 12 | } 13 | 14 | # vim: expandtab shiftwidth=4 15 | -------------------------------------------------------------------------------- /S04-exceptions/control_across_runloop.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # L 4 | 5 | # Test primarily aimed at Niecza 6 | 7 | plan 1; 8 | 9 | { 10 | sub foo($x = last) { $x } 11 | 12 | my $i = 0; 13 | for 1,2,3 { $i++; foo(); } 14 | 15 | is $i, 1, 'control operator last can be used in an inferior context'; 16 | } 17 | 18 | # vim: expandtab shiftwidth=4 19 | -------------------------------------------------------------------------------- /S04-exceptions/fail-6e.t: -------------------------------------------------------------------------------- 1 | use v6.e.PREVIEW; 2 | use Test; 3 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 4 | use Test::Util; 5 | 6 | plan 3; 7 | 8 | class X::Insignificant is Exception { 9 | has $.msg = "nothing serious"; 10 | method message { $.msg } 11 | } 12 | 13 | try { X::Insignificant.new.throw }; 14 | ok Failure.new.exception.WHAT ~~ X::Insignificant, "Failure pick up exception from $! by default";; 15 | 16 | sub foo { 17 | try { X::Insignificant.new( :msg ).throw } 18 | fail 19 | } 20 | my $f = foo; 21 | ok $f.exception.WHAT ~~ X::Insignificant, "fail pick up exception from $! by default";; 22 | is $f.exception.message, "ignorable", "fail picks up the right exception"; 23 | 24 | # vim: expandtab shiftwidth=4 25 | -------------------------------------------------------------------------------- /S04-phasers/exit-in-check.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # $failed is set to 0 (actually to Mu) at compiletime. 4 | my $failed; 5 | # At run time, if we ever reach runtime, $failed is set to 1. 6 | $failed = 1; 7 | 8 | # When we end, we check if $failed is still 0. If yes, we've never reached runtime. 9 | END { 10 | nok $failed.defined, 11 | 'exit() works in CHECK {} - $fail not yet initialized at END time'; 12 | } 13 | 14 | CHECK { 15 | # Output the TAP header... 16 | plan 2; 17 | nok $failed.defined, '$failed not yet initialized in CHECK {}'; 18 | # ...and exit, implicitly calling END. 19 | exit; 20 | } 21 | -------------------------------------------------------------------------------- /S04-statement-parsing/hash.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # L 4 | 5 | plan 8; 6 | 7 | isa-ok hash('a', 1), Hash, 'hash() returns a Hash'; 8 | is hash('a', 1).keys, 'a', 'hash() with keys/values (key)'; 9 | is hash('a', 1).values, 1, 'hash() with keys/values (values)'; 10 | 11 | is hash('a' => 1).keys, 'a', 'hash() with pair (key)'; 12 | is hash('a' => 1).values, 1, 'hash() with pair (values)'; 13 | 14 | is hash(a => 1).keys, 'a', 'hash() with autoquoted pair (key)'; 15 | is hash(a => 1).values, 1, 'hash() with autoquoted pair (values)'; 16 | 17 | # https://github.com/Raku/old-issue-tracker/issues/2192 18 | { 19 | lives-ok { my @r=2..10,;my %v=j=>10,q=>10,k=>10,a=>1|11;}, 20 | "q => doesn't trigger quoting construct"; 21 | } 22 | 23 | # vim: expandtab shiftwidth=4 24 | -------------------------------------------------------------------------------- /S04-statements/quietly.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Util; 4 | 5 | plan 4; 6 | 7 | dies-ok { quietly { die 'not quiet enough' } }, '"die" in "quietly" dies'; 8 | 9 | is_run( 'quietly { warn "muted" }; say "detum"', 10 | { status => 0, err => '', out => "detum\n" }, 11 | '"warn" in "quietly" does not warn, does not die' ); 12 | 13 | is_run( 'quietly { say "loud" }', 14 | { status => 0, err => '', out => "loud\n" }, 15 | '"say" in "quietly" works fine' ); 16 | 17 | is_run( 'quietly { note "eton" }; say "life"', 18 | { status => 0, err => "eton\n", out => "life\n" }, 19 | '"note" in "quietly" works' ); 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /S04-statements/until.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | # L and C statements/while statements 6 | # work as in 5> 7 | { 8 | my $i = 0; 9 | until $i >= 5 { $i++; }; 10 | is($i, 5, 'until $i >= 5 {} works'); 11 | } 12 | 13 | { 14 | my $i = 0; 15 | until 5 <= $i { $i++; }; 16 | is($i, 5, 'until 5 <= $i {} works'); 17 | } 18 | 19 | # with parens 20 | { 21 | my $i = 0; 22 | until ($i >= 5) { $i++; }; 23 | is($i, 5, 'until ($i >= 5) {} works'); 24 | } 25 | 26 | { 27 | my $i = 0; 28 | until (5 <= $i) { $i++; }; 29 | is($i, 5, 'until (5 <= $i) {} works'); 30 | } 31 | 32 | # vim: expandtab shiftwidth=4 33 | -------------------------------------------------------------------------------- /S05-grammar/namespace-6e.t: -------------------------------------------------------------------------------- 1 | use v6.e.PREVIEW; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | # GH rakudo/rakudo#3132 7 | eval-lives-ok q, "we can create grammar named Grammar"; 8 | 9 | # vim: expandtab shiftwidth=4 10 | -------------------------------------------------------------------------------- /S05-grammar/protos.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | # L 6 | 7 | grammar Grammar::With::Protos { 8 | token TOP { 9 | + 10 | } 11 | 12 | proto token fred { <...> } 13 | 14 | token fred:sym { 15 | \d+ 16 | } 17 | rule fred:sym { 18 | 'boz'+ 19 | } 20 | } 21 | 22 | my $m = Grammar::With::Protos.parse("foo23bar bozboz foo42"); 23 | 24 | ok($m, 'parse succeeded'); 25 | is(~$m[0], "foo23", "Submatch 1 correct"); 26 | is(~$m[1], "bar bozboz ", "Submatch 2 correct"); 27 | is(~$m[2], "foo42", "Submatch 3 correct"); 28 | 29 | # vim: expandtab shiftwidth=4 30 | -------------------------------------------------------------------------------- /S05-match/arrayhash.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | =begin pod 4 | 5 | Matching against an array or a hash. 6 | 7 | =end pod 8 | 9 | plan 9; 10 | 11 | # Matching against an array should be true if any of the values match. 12 | my @a = ('a', 'b' ); 13 | ok(@a ~~ / 'b' /, q|@a ~~ / 'b' /|); 14 | ok(@a ~~ / ^ 'b' /, q|@a ~~ / ^ 'b' /|); 15 | ok(@a ~~ / ^ 'a' /, q|@a ~~ / ^ 'a' /|); 16 | ok(@a ~~ / ^ 'a' $ /, q|@a ~~ / ^ 'a' $ /|); 17 | 18 | # Matching against a sequence (possibly infinite) 19 | ok(("a"...* ~~ / z /), q|"a"...* ~~ / z /|); 20 | 21 | # Matching against a hash should be true if any of the keys match. 22 | my %a = ('a' => 1, 'b' => 2); 23 | ok(%a ~~ / 'b' /, q|%a ~~ / 'b' /|); 24 | ok(%a ~~ / ^ 'b' /, q|%a ~~ / ^ 'b' /|); 25 | ok(%a ~~ / ^ 'a' /, q|%a ~~ / ^ 'a' /|); 26 | ok(%a ~~ / ^ 'a' $ /, q|%a ~~ / ^ 'a' $ /|); 27 | 28 | # vim: expandtab shiftwidth=4 29 | -------------------------------------------------------------------------------- /S05-match/basics.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 2; 4 | 5 | { 6 | my $m = "abc" ~~ /b/; 7 | my Str(Match) $sm = $m; 8 | isa-ok $sm, Str, "Match correctly coerces into Str"; 9 | is $sm, "b", "coerced string is as expected"; 10 | } 11 | 12 | done-testing; 13 | -------------------------------------------------------------------------------- /S05-metasyntax/assertions.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | # L >>)"/indicates a code assertion:> 6 | 7 | =begin pod 8 | 9 | This file was derived from the Perl CPAN module Perl6::Rules, 10 | version 0.3 (12 Apr 2004), file t/assert.t. 11 | 12 | It has (hopefully) been, and should continue to be, updated to 13 | be valid perl6. 14 | 15 | =end pod 16 | 17 | ok("1" ~~ m/ (\d) /, '1 < 5'); 18 | ok("5" !~~ m/ (\d) /, '5 !< 5'); 19 | 20 | ok("x254" ~~ m/x (\d+): /, '254 < 255'); 21 | ok("x255" !~~ m/x (\d+): /, '255 !< 255'); 22 | 23 | # vim: expandtab shiftwidth=4 24 | -------------------------------------------------------------------------------- /S05-metasyntax/delimiters.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 21; 4 | 5 | # L 6 | 7 | my @delims = < ^ ° ! " § $ % @ € & / = ? ` * + ~ ; , . | >; 8 | my %todo; 9 | 10 | 11 | for @delims -> $d { 12 | my $ok = try { EVAL("my \$x = 'abc'; \$x ~~ m{$d}b{$d}") }; 13 | my $nok = try { EVAL("my \$x = 'abc'; \$x ~~ m{$d}d{$d}") }; 14 | my $is = try { EVAL("my \$x = 'abc'; \$x ~~ s{$d}a{$d}b{$d}; \$x") } eq 'bbc'; 15 | 16 | todo "$d not yet supported" if %todo{$d}; 17 | ok $ok && !$nok && $is, "$d as delimiter in match and substitution"; 18 | } 19 | 20 | # vim: expandtab shiftwidth=4 21 | -------------------------------------------------------------------------------- /S05-metasyntax/null.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | =begin pod 4 | 5 | This file was derived from the Perl CPAN module Perl6::Rules, 6 | version 0.3 (12 Apr 2004), file t/null.t. 7 | 8 | It has (hopefully) been, and should continue to be, updated to 9 | be valid perl6. 10 | 11 | =end pod 12 | 13 | plan 4; 14 | 15 | # L 16 | 17 | ok("" ~~ m//, 'Simple null as '); 18 | ok("" ~~ m/''/, "Simple null as ''"); 19 | ok("a" ~~ m//, 'Simple null A'); 20 | 21 | ok("ab" ~~ m{ab}, 'Compound null AB'); 22 | 23 | # vim: expandtab shiftwidth=4 24 | -------------------------------------------------------------------------------- /S05-substitution/67222.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 1; 3 | 4 | $_ = "(foo,bar,(baz))"; 5 | $_.=subst( /<-[(),]>+/, { "'$/'" }, :g ); 6 | 7 | # https://github.com/Raku/old-issue-tracker/issues/1117 8 | ok $_ eq "('foo','bar',('baz'))", "RT #67222 check the value of \$/ in closures in the second argument of .=subst calls"; 9 | 10 | # vim: expandtab shiftwidth=4 11 | -------------------------------------------------------------------------------- /S05-transliteration/79778.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 1; 3 | 4 | # https://github.com/Raku/old-issue-tracker/issues/2277 5 | is "this sentence no verb".trans( / \s+ / => " " ), 'this sentence no verb',"got expected string" ; 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /S06-advanced/return_function.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 4; 3 | 4 | # L function/prints 1 via named argument> 5 | 6 | { 7 | sub f () { return :x<1> } 8 | sub g ($x) { $x } 9 | 10 | my $x := |(f); # binds 1 to $x, via a named argument 11 | is $x, 1, 'binds 1 to $x, via a named argument'; 12 | is( g(|(f)), 1, "prints 1, via a named argument"); 13 | } 14 | 15 | { 16 | # return two positional Pair objects 17 | sub t2 () { return( (:x<1>), (:y<2>) ) } 18 | my ($rv1, $rv2); 19 | try { ($rv1, $rv2) := |(t2) }; 20 | is($rv1, Pair, "returned Pair object 1"); 21 | is($rv2, Pair, "returned Pair object 2"); 22 | } 23 | 24 | # vim: expandtab shiftwidth=4 25 | -------------------------------------------------------------------------------- /S06-multi/compile-time.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | BEGIN plan 2; 3 | 4 | use lib $?FILE.IO.parent(2).child("packages/S06-multi/lib"); 5 | use compile-time; 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /S06-operator-overloading/semicolon.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 3; 3 | 4 | # https://github.com/Raku/old-issue-tracker/issues/2408 5 | # A user-declared infix:<;> clashes with statement stopper ';' in Rakudo 6 | 7 | my $marker = 0; 8 | 9 | sub infix:<;>($a, $b) { 10 | $marker = 1; 11 | 0, 0 12 | }; 13 | 14 | my @a = 1; 2; 3; 15 | 16 | 17 | is +@a, 1, '@a is array with 1 element'; 18 | is @a[0], 1, 'first element of @a eq 1'; 19 | is $marker, 0, 'overloaded infix ; hasn\'t been called'; 20 | 21 | 22 | # vim: expandtab shiftwidth=4 23 | -------------------------------------------------------------------------------- /S06-other/main-eval.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 3; 4 | 5 | # L subroutine/"the compilation unit was directly 6 | # invoked rather than by being required by another compilation unit"> 7 | 8 | # a MAIN sub in EVAL() shouldn't be called 9 | 10 | my $main_invoked = 0; 11 | my $eval_worked = 0; 12 | EVAL q[ 13 | my @*ARGS = ; 14 | sub MAIN($a, $b) { $main_invoked = 1 }; 15 | $eval_worked = 1; 16 | ]; 17 | ok ! $!, 'no exception thrown'; 18 | ok $eval_worked, 'EVAL code executed'; 19 | # https://github.com/Raku/old-issue-tracker/issues/3947 20 | is $main_invoked, 0, 'sub MAIN is not called in EVAL()'; 21 | 22 | # vim: expandtab shiftwidth=4 23 | -------------------------------------------------------------------------------- /S06-other/pairs-as-lvalues.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 5; 4 | 5 | # L 6 | 7 | throws-like 'my $var; (key => $var) = "value"', X::Assignment::RO; 8 | 9 | { 10 | my ($a, $b); 11 | $b = 'b'; 12 | :(:$a is raw) := \(:a($b)); 13 | is $a, 'b', 'can bind to single pair'; 14 | ok $a =:= $b, 'variables are bound together (?)'; 15 | } 16 | 17 | { 18 | my ($t, $m); 19 | :(:type($t), :motivation($m)) := (type => 'geek', motivation => '-Ofun'); 20 | is $t, 'geek', 'bound to the first pair'; 21 | is $m, '-Ofun', 'bound to the second pair'; 22 | } 23 | 24 | 25 | 26 | 27 | # vim: expandtab shiftwidth=4 28 | -------------------------------------------------------------------------------- /S06-signature/closure-over-parameters.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | =begin desc 4 | 5 | Closure over parameters of outer subs, as per 6 | # L 8 | # L 9 | 10 | =end desc 11 | 12 | plan 4; 13 | 14 | sub factorial (Int $n) { 15 | my sub facti (Int $acc, Int $i) { 16 | return $acc if $i > $n; 17 | facti($acc * $i, $i + 1); 18 | } 19 | facti(1, 1); 20 | } ; 21 | 22 | is factorial(0), 1, "closing over params of outer subs (0)"; 23 | is factorial(1), 1, "closing over params of outer subs (1)"; 24 | is factorial(2), 2, "closing over params of outer subs (2)"; 25 | is factorial(3), 6, "closing over params of outer subs (3)"; 26 | 27 | # vim: expandtab shiftwidth=4 28 | -------------------------------------------------------------------------------- /S06-signature/named-placeholders.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | #L 6 | 7 | sub one_placeholder is test-assertion { 8 | is $:bla, 2, "A single named placeholder works"; 9 | } 10 | 11 | one_placeholder(:bla(2)); 12 | 13 | sub two_placeholders is test-assertion { 14 | is $:b, 1, "Named dispatch isn't broken for placeholders"; 15 | is $:a, 2, "Named dispatch isn't broken for placeholders"; 16 | } 17 | 18 | two_placeholders(:a(2), :b(1)); 19 | 20 | # https://github.com/rakudo/rakudo/issues/1356 21 | { 22 | use isms 'Perl5'; 23 | { is-deeply $:F, 42, 'named placeholder $:F ok' }(:42F) 24 | } 25 | 26 | # vim: expandtab shiftwidth=4 27 | -------------------------------------------------------------------------------- /S06-signature/passing-hashes.t: -------------------------------------------------------------------------------- 1 | # L 2 | # TODO: better smart-linking 3 | 4 | use Test; 5 | plan 3; 6 | 7 | sub sanity() is test-assertion { 8 | my %sane = 'a'..'d' Z 1..4; 9 | isa-ok(%sane, Hash, '%sane is a Hash'); 10 | } 11 | 12 | sub insanity(%baloney) is test-assertion { 13 | isa-ok(%baloney, Hash, '%baloney is a Hash'); 14 | } 15 | 16 | # sanity 0 17 | my %h = 'a'..'d' Z 1..4; 18 | isa-ok(%h.WHAT, Hash, '%h is a Hash'); 19 | 20 | #sanity 1; 21 | sanity; 22 | 23 | # Hash passed to a sub used to become a List in pugs 24 | insanity %h; 25 | 26 | 27 | # vim: expandtab shiftwidth=4 28 | -------------------------------------------------------------------------------- /S06-signature/slurpy-blocks.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 6; 4 | 5 | # L 6 | 7 | sub foo (Code *$block) { 8 | return $block.(); 9 | } 10 | 11 | is(foo():{ "foo" }, 'foo', 'Code *$block - 1'); 12 | is(foo():{ 0 }, 0, 'Code *$block - 2'); 13 | 14 | sub bar (*&block) { 15 | return &block.(); 16 | } 17 | 18 | is(bar():{ "bar" }, 'bar', '*&block - 1'); 19 | is(bar():{ 0 }, 0, '*&block - 2'); 20 | 21 | is(foo():{ "foo" }, bar():{ "foo" }, 'Code *$block == *&block - 1'); 22 | is(foo():{ 0 }, bar():{ 0 }, 'Code *$block == *&block - 2'); 23 | 24 | # vim: expandtab shiftwidth=4 25 | -------------------------------------------------------------------------------- /S06-signature/unpack-object.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 4; 3 | 4 | { 5 | my $tracker = ''; 6 | for a => 1, b => 2 -> Pair $p (:$key, :$value) { 7 | $tracker ~= "|$key,$value"; 8 | } 9 | is $tracker, '|a,1|b,2', 'unpacking a Pair'; 10 | } 11 | 12 | { 13 | class A { has $.x }; 14 | 15 | my $tracker = ''; 16 | for A.new(x => 4), A.new(x => 2) -> $ (:$x) { 17 | $tracker ~= $x; 18 | } 19 | is $tracker, '42', 'unpacking attribute of custom class'; 20 | } 21 | 22 | { 23 | multi f((Int :$value, *%)) { "Int $value" } 24 | multi f((Str :$value, *%)) { "Str $value" } 25 | is f('a' => 3 ), 'Int 3', 'typed Pair unpackaing (Int)'; 26 | is f('a' => 'x'), 'Str x', 'typed Pair unpackaing (Str)'; 27 | 28 | } 29 | 30 | # vim: expandtab shiftwidth=4 31 | -------------------------------------------------------------------------------- /S06-traits/as.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 5; 4 | 5 | =begin description 6 | 7 | Testing coercion types. 8 | 9 | =end description 10 | 11 | sub t1(Int() $x) is test-assertion { 12 | is($x.WHAT.gist, '(Int)', 'object bound .WHATs to the right thing'); 13 | is($x, 1, 'object bound was coerced to the right value'); 14 | } 15 | t1(4/3); 16 | 17 | sub t2(Int(Rat) $x) is test-assertion { 18 | is($x.WHAT.gist, '(Int)', 'object bound .WHATs to the right thing'); 19 | is($x, 2, 'object bound was coerced to the right value'); 20 | } 21 | t2(7/3); 22 | dies-ok { EVAL("t2('omg hedgehog!')") }, 'Type checks still enforced'; 23 | 24 | # vim: expandtab shiftwidth=4 25 | -------------------------------------------------------------------------------- /S06-traits/is-readonly.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | # L 6 | # should be moved with other subroutine tests? 7 | 8 | { 9 | my $a = 3; 10 | 11 | ok (try { VAR($a).defined }), ".VAR on a plain normal initialized variable returns true"; 12 | } 13 | 14 | # vim: expandtab shiftwidth=4 15 | -------------------------------------------------------------------------------- /S06-traits/slurpy-is-rw.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 3; 4 | 5 | # test splatted parameter for rw ability 6 | # L 7 | 8 | my @test = 1..5; 9 | my $test = 42; 10 | lives-ok { 11 | my sub should_work ( *@list is raw ) { 12 | @list[0] = "hi"; 13 | @list[*-1] = "ho"; 14 | } 15 | should_work(@test, $test); 16 | }, "trying to use an 'is rw' splat does work out"; 17 | is(@test[0], "hi", "@test was changed"); 18 | is($test, "ho", '$test was changed'); 19 | 20 | # vim: expandtab shiftwidth=4 21 | -------------------------------------------------------------------------------- /S10-packages/README: -------------------------------------------------------------------------------- 1 | S10-packages/README 2 | 3 | The packages these tests use are stored in packages to avoid the use of 4 | a hyphen in the package name, which is not allowed without quoting. 5 | -------------------------------------------------------------------------------- /S10-packages/joined-namespaces.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | use lib $?FILE.IO.parent(2).add("packages/Fancy/lib"); 4 | 5 | plan 3; 6 | 7 | use Fancy::Utilities; 8 | ok EVAL('class Fancy { }; 1'), 'can define a class A when module A::B has been used'; 9 | 10 | eval-lives-ok 'my class A::B { ... }; A::B.new(); class A::B { };', 11 | 'can stub lexical classes with joined namespaces'; 12 | 13 | # https://github.com/Raku/old-issue-tracker/issues/1436 14 | class Outer::Inner { }; 15 | dies-ok { EVAL 'Outer.foo' }, 16 | 'can sensibly die when calling method on package'; 17 | 18 | # vim: expandtab shiftwidth=4 19 | -------------------------------------------------------------------------------- /S11-compunit/compunit-dependencyspecification.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 6; 4 | 5 | dies-ok { CompUnit::DependencySpecification.new }; 6 | dies-ok { CompUnit::DependencySpecification.new(:short-name(1)) }; 7 | ok my $ds = CompUnit::DependencySpecification.new(:short-name); 8 | is $ds.version-matcher, True; 9 | is $ds.auth-matcher, True; 10 | is $ds.api-matcher, True; 11 | 12 | # vim: expandtab shiftwidth=4 13 | -------------------------------------------------------------------------------- /S11-compunit/compunit-repository.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 9; 4 | 5 | for .combinations[0 .. *-2] { 6 | throws-like "class :: does CompUnit::Repository \{ { $_.map({"method {$_}() \{\}"}).join(';') } \}", Exception; 7 | } 8 | 9 | eval-lives-ok ' 10 | class MyRepo does CompUnit::Repository { 11 | method id() { } 12 | method need() { } 13 | method load() { } 14 | method loaded() { } 15 | } 16 | '; 17 | 18 | ok $*REPO ~~ CompUnit::Repository; 19 | 20 | # vim: expandtab shiftwidth=4 21 | -------------------------------------------------------------------------------- /S11-compunit/rt126904.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | # https://github.com/Raku/old-issue-tracker/issues/4865 6 | my $lib-path = $?FILE.IO.parent(2).add('packages/RT126904/lib').absolute; 7 | 8 | my $proc = run $*EXECUTABLE, '-I', $lib-path, '-e', 9 | 'use Woohoo::Foo::Bar; use Woohoo::Foo::Baz; my Woohoo::Foo::Bar $bar;', 10 | :err; 11 | 12 | #?rakudo.jvm todo 'Missing serialize function for REPR ContextRef' 13 | is($proc.err.slurp, '', "compilation errors"); 14 | 15 | # vim: expandtab shiftwidth=4 16 | -------------------------------------------------------------------------------- /S11-modules/gh2979.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 8; 4 | 5 | # GH#2979 Symbols are not to be exported in containerized form. 6 | 7 | use lib $?FILE.IO.parent(2).add("packages/S11-modules/lib"); 8 | 9 | #?rakudo.jvm emit # compile time error: Method 'name' not found for invocant of class 'Any' 10 | use GH2979; 11 | 12 | #?rakudo.jvm 8 skip 'fails due to above error' 13 | is @foo.VAR.^name, 'Array', 're-exported Array'; 14 | is %foo.VAR.^name, 'Hash', 're-exported Hash'; 15 | is $foo.VAR.^name, 'Scalar', 're-exported Scalar'; 16 | is &foo.VAR.^name, 'Sub', 're-exported Sub'; 17 | is @bar.VAR.^name, 'Array', 'exported Array'; 18 | is %bar.VAR.^name, 'Hash', 'exported Hash'; 19 | is $bar.VAR.^name, 'Scalar', 'exported Scalar'; 20 | is &bar.VAR.^name, 'Sub', 'exported Sub'; 21 | 22 | # vim: expandtab shiftwidth=4 23 | -------------------------------------------------------------------------------- /S11-modules/lexical.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | use lib $?FILE.IO.parent(2).child("packages/S11-modules/lib"); 4 | 5 | plan 3; 6 | 7 | { 8 | use Foo; 9 | is foo(), 'Foo::foo', 'could import foo()'; 10 | } 11 | dies-ok {EVAL('foo()') }, 'sub is only imported into the inner lexical scope'; 12 | 13 | { 14 | use EmptyClass; 15 | my EmptyClass $foo; 16 | } 17 | dies-ok {EVAL('my EmptyClass $bar')}, 'Package is only imported into the inner lexical scope'; 18 | 19 | # vim: expandtab shiftwidth=4 20 | -------------------------------------------------------------------------------- /S11-modules/module-file.t: -------------------------------------------------------------------------------- 1 | unit module Foo::Bar; 2 | use Test; 3 | 4 | # L 5 | 6 | plan 4; 7 | 8 | is($?PACKAGE.^name, 'Foo::Bar', '$?PACKAGE for "module Foo::Bar;"'); 9 | is($?MODULE.^name, 'Foo::Bar', '$?MODULE for "module Foo::Bar;"'); 10 | is(::?PACKAGE.^name, 'Foo::Bar', '::?PACKAGE for "module Foo::Bar;"'); 11 | is(::?MODULE.^name, 'Foo::Bar', '::?MODULE for "module Foo::Bar;"'); 12 | 13 | # vim: expandtab shiftwidth=4 14 | -------------------------------------------------------------------------------- /S11-modules/module.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # L 4 | 5 | plan 8; 6 | 7 | module Foo { 8 | is($?PACKAGE.^name, 'Foo', '$?PACKAGE for "module Foo {}"'); 9 | is($?MODULE.^name, 'Foo', '$?MODULE for "module Foo {}"'); 10 | is(::?PACKAGE.^name, 'Foo', '::?PACKAGE for "module Foo {}"'); 11 | is(::?MODULE.^name, 'Foo', '::?MODULE for "module Foo {}"'); 12 | 13 | module Bar { 14 | is($?PACKAGE.^name, 'Foo::Bar', '$?PACKAGE for "module Foo::Bar {}"'); 15 | is($?MODULE.^name, 'Foo::Bar', '$?MODULE for "module Foo::Bar {}"'); 16 | is(::?PACKAGE.^name, 'Foo::Bar', '::?PACKAGE for "module Foo::Bar {}"'); 17 | is(::?MODULE.^name, 'Foo::Bar', '::?MODULE for "module Foo::Bar {}"'); 18 | } 19 | } 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /S11-modules/need.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | use lib $?FILE.IO.parent(2).add("packages/Export_Pack/lib"); 4 | 5 | plan 2; 6 | 7 | { 8 | need Export_PackA; 9 | 10 | is Export_PackA::exported_foo(), 11 | 42, 'Can "need" a module'; 12 | throws-like 'exported_foo()', 13 | X::Undeclared::Symbols, '"need" did not import the default export list'; 14 | } 15 | 16 | # vim: expandtab shiftwidth=4 17 | -------------------------------------------------------------------------------- /S11-modules/rakulib.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Util; 4 | 5 | plan 1; 6 | 7 | # https://github.com/Raku/old-issue-tracker/issues/6108 8 | is_run 'BEGIN { BEGIN { q{S11modulesRakuLibTest.rakumod}.IO.spurt(q{package { say q{all your base} }}); %*ENV=qq{}; }; use S11modulesRakuLibTest }', 9 | { 10 | out => "", 11 | status => * != 0, 12 | }, 'RT 130883 is fixed'; 13 | 14 | unlink "S11modulesRakuLibTest.rakumod"; 15 | 16 | # vim: expandtab shiftwidth=4 17 | -------------------------------------------------------------------------------- /S11-modules/re-export.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 3; 4 | 5 | # L 6 | 7 | use lib $?FILE.IO.parent(2).add("packages/S11-modules/lib"); 8 | use OuterModule :ALL; 9 | 10 | is(foo(), 'Inner::foo', 're-exporting works using is export(:DEFAULT)'); 11 | is(bar(), 'Inner::bar', 're-exporting works using is export'); 12 | is(baz(), 'Inner::baz', 're-exporting works using is export(:MANDATORY)'); 13 | # is(qux(), 'Inner::qux', 're-exporting works using is export(:sometag)'); 14 | 15 | # vim: expandtab shiftwidth=4 16 | -------------------------------------------------------------------------------- /S11-modules/runtime.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | use lib $?FILE.IO.parent(2).add("packages/S11-modules/lib"); 4 | 5 | plan 1; 6 | 7 | eval-lives-ok 'use RuntimeCreatedPackage;', "Runtime package creation doesn't screw up module loading"; 8 | 9 | # vim: expandtab shiftwidth=4 10 | -------------------------------------------------------------------------------- /S12-class/declaration-order.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 2; 4 | 5 | 6 | =begin pod 7 | 8 | A class can only derive already declared classes. 9 | 10 | =end pod 11 | 12 | # L 13 | 14 | # need eval-lives-ok here because class declarations happen at compile time 15 | eval-lives-ok ' class A {}; class B is A {}; ', "base before derived: lives"; 16 | throws-like ' class D is C {}; class C {}; ', X::Inheritance::UnknownParent, 17 | "derived before base: dies"; 18 | 19 | # vim: expandtab shiftwidth=4 20 | -------------------------------------------------------------------------------- /S12-class/inheritance-class-methods.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 5; 3 | 4 | # L 5 | 6 | class C {method h {42}} 7 | class B is C { method g { self.f } }; 8 | class A is B { method f {1; } }; 9 | 10 | class AA {method i {108}} 11 | class D is A is AA {method f {2} } 12 | 13 | is(A.g(), 1, 'inheritance works on class methods'); 14 | is(A.h(), 42, '>1 level deep inheritance works on class methods'); 15 | is(D.h(), 42, 'multiple inheritance works on class methods (1)'); 16 | is(D.i(), 108, 'multiple inheritance works on class methods (2)'); 17 | is(D.f(), 2, 'method from class is selected over inherited method'); 18 | 19 | # vim: expandtab shiftwidth=4 20 | -------------------------------------------------------------------------------- /S12-class/literal.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | use lib $?FILE.IO.parent(2).add: 'packages/FooBarBaz/lib'; 4 | use Foo; 5 | 6 | plan 2; 7 | 8 | # L 9 | # Testing class literals 10 | my $test1; 11 | 12 | ok ($test1 = ::Foo) ~~ Foo, "::Foo is a valid class literal"; 13 | 14 | # Test removed per L<"http://www.nntp.perl.org/group/perl.perl6.language/22220"> 15 | # Foo.isa(Class) is false. 16 | #isa-ok($test1, "Class", "It's a class"); 17 | 18 | my $x = EVAL 'Foo'; 19 | ok($x === ::Foo, "Foo is now a valid class literal"); 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /S12-class/self-inheritance.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 2; 4 | 5 | =begin pod 6 | 7 | xinming audreyt: class A is A { }; <--- This error is reported at compile time or runtime? 8 | xinming I mean, it will reported when it sees `class A is A` or, when A.new is invoked 9 | audreyt I suspect compile time is the correct answer 10 | 11 | =end pod 12 | 13 | throws-like 'role RA does RA { }; 1', X::InvalidType, "Testing `role A does A`"; 14 | throws-like 'class CA is CA { }; 1', X::Inheritance::SelfInherit, "Testing `class A is A`"; 15 | 16 | 17 | # vim: expandtab shiftwidth=4 18 | -------------------------------------------------------------------------------- /S12-class/type-object.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 6; 4 | 5 | is Any.Str, '', 'Any.Str is empty string'; 6 | is Any.Stringy, '', 'Any.Str is empty string'; 7 | is Any.gist, '(Any)', 'Any.gist has those parens'; 8 | 9 | # maybe a bit too retrictive? 10 | is Any.raku, 'Any', 'Any.raku does not have parens'; 11 | 12 | is Any.^name, 'Any', '.^name'; 13 | 14 | isa-ok (class A { }).new, A, 'can instantiate return value of class declaration'; 15 | 16 | # vim: expandtab shiftwidth=4 17 | -------------------------------------------------------------------------------- /S12-construction/autopairs.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | 6 | #L 7 | 8 | { 9 | eval-lives-ok('my $a; class Ta { has $.a }; my Ta $c .= new(:$a)', 10 | 'class instantiation with autopair, no spaces'); 11 | eval-lives-ok('my $a; class Tb { has $.a }; my Tb $Tb .= new(:$a )', 12 | 'class instantiation with autopair, spaces'); 13 | eval-lives-ok('my $a; role Tc { has $.a }; my Tc $c .= new(:$a)', 14 | 'role instantiation with autopair, no spaces'); 15 | eval-lives-ok('my $a; role Td { has $.a }; my Td $c .= new(:$a )', 16 | 'role instantiation with autopair, spaces'); 17 | } 18 | 19 | # vim: expandtab shiftwidth=4 20 | -------------------------------------------------------------------------------- /S12-enums/non-int.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 6; 3 | 4 | { 5 | my enum A (a => 'foo', b => 'bar'); 6 | is a.Str, 'foo', 'stringy enum first value'; 7 | is b.Str, 'bar', 'stringy enum first value'; 8 | } 9 | 10 | throws-like 'my enum B (a => 1, b => "bar")', Exception, 11 | 'mixed type enums are forbidden'; 12 | 13 | #?rakudo todo 'NYI' 14 | eval-lives-ok 'my Cool enum C (a => 1, b => "bar")', 15 | '... unless that type covers both enum value types'; 16 | 17 | throws-like 'my Str enum D (a => 1)', Exception, 18 | 'violating an explicit type constraint dies'; 19 | 20 | { 21 | my enum E ( a => 'x', 'b'); 22 | is E::b.Str, 'y', 'Str enum correctly uses string-increment'; 23 | } 24 | 25 | # vim: expandtab shiftwidth=4 26 | -------------------------------------------------------------------------------- /S12-meta/grammarhow.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | grammar Foo { 6 | token TOP { } 7 | token bottom { } 8 | } 9 | 10 | class Foo::Actions { 11 | method TOP($/) { 12 | my $grmr := Metamodel::GrammarHOW.new_type(name => 'BNFGrammar'); 13 | $grmr.^add_method('TOP', token { }); 14 | $grmr.^add_method('foo', $.ast[0]); 15 | $grmr.^compose; 16 | { 17 | my $/; 18 | $grmr.new.parse('bar'); 19 | } 20 | } 21 | 22 | method bottom($/) { 23 | make [token { "bar" }] 24 | } 25 | } 26 | 27 | lives-ok { Foo.parse('', :actions(Foo::Actions)) } 28 | 29 | # vim: expandtab shiftwidth=4 30 | -------------------------------------------------------------------------------- /S12-methods/how.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 3; 4 | 5 | lives-ok { 4.HOW.HOW }, 'Can access meta class of meta class'; 6 | 7 | throws-like 'my $x; ($x = "hi").HOW = Block;', X::Assignment::RO, 8 | 'Cannot assign to .HOW'; 9 | 10 | # https://github.com/Raku/old-issue-tracker/issues/2001 11 | { 12 | sub RT76928(%h?) { %h.HOW } 13 | lives-ok { RT76928() }, 'Can call .HOW on an optional sub parameter'; 14 | } 15 | 16 | # vim: expandtab shiftwidth=4 17 | -------------------------------------------------------------------------------- /S12-methods/topic.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # old: L 4 | # (This is an an "update" section.) 5 | # not mentioned explicitly in S12, but still true. 6 | 7 | plan 2; 8 | 9 | class Foo { 10 | method no_topic { .^name } 11 | method topic ($_: ) { .echo } 12 | method echo { "echo" } 13 | } 14 | 15 | { 16 | my Foo $foo .= new; 17 | is $foo.no_topic, 'Any', '$_ is not set in methods...'; 18 | } 19 | 20 | { 21 | my Foo $foo .= new; 22 | is $foo.topic(), "echo", '...unless $_ the invocant name is specified to be "$_"'; 23 | } 24 | 25 | # vim: expandtab shiftwidth=4 26 | -------------------------------------------------------------------------------- /S12-traits/custom/client.rakumod: -------------------------------------------------------------------------------- 1 | use customtrait; 2 | 3 | sub bar() is export is customtrait { "Success" } 4 | -------------------------------------------------------------------------------- /S12-traits/custom/customtrait.rakumod: -------------------------------------------------------------------------------- 1 | multi sub trait_mod:(Sub $m, :$customtrait!) is export { 2 | $m.wrap: sub (|) { nextsame } 3 | } 4 | -------------------------------------------------------------------------------- /S12-traits/parameterized.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 8; 4 | 5 | =begin pod 6 | 7 | Parameterized traits tests, see L. 8 | 9 | =end pod 10 | 11 | # L 12 | # Basic definition 13 | role cool { 14 | has $.cool; 15 | 16 | multi sub trait_auxiliary:(cool $trait, Any $container; $val) { #OK not used 17 | $.cool = $val; 18 | $container does cool($val); 19 | } 20 | } 21 | 22 | my $a = 42; 23 | is $a, 42, "basic sanity (1)"; 24 | lives-ok {$a does cool(23)}, "imperative does worked (1)"; 25 | is $a.cool, 23, "attribute was set correctly (1)"; 26 | 27 | my $b = 23; 28 | is $b, 23, "basic sanity (2)"; 29 | ok $b does cool("hi"), "imperative does worked (2)"; 30 | is $b.cool, "hi", "attribute was set correctly (2)"; 31 | 32 | # vim: expandtab shiftwidth=4 33 | -------------------------------------------------------------------------------- /S12-traits/precomp.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | use lib $*PROGRAM.sibling("custom"); 4 | use client; 5 | 6 | plan 1; 7 | 8 | is-deeply bar(), "Success", 'did we compile and execute ok'; 9 | 10 | # vim: expandtab shiftwidth=4 11 | -------------------------------------------------------------------------------- /S13-overloading/fallbacks-deep.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 2; 4 | 5 | # L 6 | 7 | class Base {has $.value is rw;} 8 | class Exponent {has $.value is rw;} 9 | 10 | multi sub infix:<+> (Base $b, Exponent $e) is deep {$b.value ** $e.value} 11 | 12 | my $base = Base.new(); 13 | my $exp = Exponent.new(); 14 | $base.value = 2; 15 | $exp.value = 5; 16 | 17 | is($base + $exp, 32, 'defining infix:<+> works'); 18 | 19 | $base += $exp; 20 | is($base, 32, 'is deep generates infix:<+=> on infix:<+>'); 21 | 22 | # vim: expandtab shiftwidth=4 23 | -------------------------------------------------------------------------------- /S14-roles/bool.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 3; 3 | 4 | # boolification of roles 5 | 6 | sub b($x) { $x ?? 'aye' !! 'nay' } 7 | 8 | my Stringy $s; 9 | is b($s), 'nay', 'boolification of role type object'; 10 | 11 | my Stringy $t = ''; 12 | is b($t), 'nay', 'boolification of role-typed container (false)'; 13 | 14 | my Stringy $u = 'moin'; 15 | is b($u), 'aye', 'boolification of role-typed container (true)'; 16 | 17 | # vim: expandtab shiftwidth=4 18 | -------------------------------------------------------------------------------- /S14-roles/generic-subtyping.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 5; 4 | 5 | lives-ok({ EVAL(Q:to/ROLES/) }, 'can do subtyped generic roles'); 6 | role R1[Any ::T] { } 7 | role R2[Cool ::T] does R1[T] { } 8 | ROLES 9 | 10 | EVAL(Q:to/TESTS/); 11 | ok(R2[Cool] ~~ R1[Any], 'subtyped generic roles'); 12 | ok(R2[Cool] ~~ R2[Cool], 'subtyped generic roles'); 13 | ok(R2[Int] ~~ R2[Cool], 'subtyped generic roles'); 14 | TESTS 15 | 16 | lives-ok({ EVAL(Q:to/ROLE/) }, 'can lookup roles of subtyped generic roles done by roles before they get composed'); 17 | multi sub trait_mod:(Mu:U \T, :ok($)!) { T.^roles[0].^roles } 18 | 19 | role R2[Int ::T] does R1[T] is ok { } 20 | ROLE 21 | 22 | # vim: expandtab shiftwidth=4 23 | -------------------------------------------------------------------------------- /S15-nfg/grapheme-break.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 1; 3 | # https://github.com/rakudo/rakudo/commit/7f970357bd59c011e9f998ba885d317401851781 4 | ok 1, 'dummy test file'; 5 | 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /S15-nfg/long-uni.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 24; 4 | 5 | for (10, 100, 1000, 10000) -> $n { 6 | my @codes = flat (0x0044, 0x0307, 0x0323) xx $n; 7 | 8 | my $s = Uni.new(@codes).Str; 9 | is $s.chars, $n, 'long Uni -> Str works out'; 10 | 11 | my $nfc = $s.NFC; 12 | is $nfc.codes, 2 * $n, 'long Str -> NFC works out'; 13 | is $nfc[0], 0x1E0C, 'NFC buffer has correct first value'; 14 | is $nfc[1], 0x307, 'NFC buffer has correct second value'; 15 | is $nfc[* - 2], 0x1E0C, 'NFC buffer has correct second-to-last value'; 16 | is $nfc[* - 1], 0x307, 'NFC buffer has correct last value'; 17 | } 18 | 19 | # vim: expandtab shiftwidth=4 20 | -------------------------------------------------------------------------------- /S15-nfg/many-combiners.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 5; 4 | 5 | # https://github.com/Raku/old-issue-tracker/issues/4263 6 | my $test-str = "N̴͔̈F̷͚́G̶͔̈́ ̷̃͜i̴̡͘s̴̰͘ ̶̫̉a̵̬͆w̴̢͒ę̴̏s̴̱̋o̴̫̓m̸̜͐e̶̥̋"; 7 | is $test-str.chars, 14, 'Correct value of .chars for string with many combiners'; 8 | is "N̴͔̈F̷͚́G̶͔̈́ ̷̃͜i̴̡͘s̴̰͘ ̶̫̉a̵̬͆w̴̢͒ę̴̏s̴̱̋o̴̫̓m̸̜͐e̶̥̋".NFC.elems, 56, 'Can .NFC string with many combiners'; 9 | is "N̴͔̈F̷͚́G̶͔̈́ ̷̃͜i̴̡͘s̴̰͘ ̶̫̉a̵̬͆w̴̢͒ę̴̏s̴̱̋o̴̫̓m̸̜͐e̶̥̋".NFD.elems, 57, 'Can .NFD string with many combiners'; 10 | is "N̴͔̈F̷͚́G̶͔̈́ ̷̃͜i̴̡͘s̴̰͘ ̶̫̉a̵̬͆w̴̢͒ę̴̏s̴̱̋o̴̫̓m̸̜͐e̶̥̋".NFKC.elems, 56, 'Can .NFKC string with many combiners'; 11 | is "N̴͔̈F̷͚́G̶͔̈́ ̷̃͜i̴̡͘s̴̰͘ ̶̫̉a̵̬͆w̴̢͒ę̴̏s̴̱̋o̴̫̓m̸̜͐e̶̥̋".NFKD.elems, 57, 'Can .NFKD string with many combiners'; 12 | 13 | # vim: expandtab shiftwidth=4 14 | -------------------------------------------------------------------------------- /S15-nfg/many-threads.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | my @promises = do for ^4 -> $t { 6 | start (Uni.new((800..850).pick(5)) xx 2000)>>.Str; 7 | } 8 | await @promises; 9 | 10 | is @promises[0].result.elems, 2000, 'Thread 1 made strings successfully'; 11 | is @promises[1].result.elems, 2000, 'Thread 2 made strings successfully'; 12 | is @promises[2].result.elems, 2000, 'Thread 3 made strings successfully'; 13 | is @promises[3].result.elems, 2000, 'Thread 4 made strings successfully'; 14 | 15 | # vim: expandtab shiftwidth=4 16 | -------------------------------------------------------------------------------- /S15-string-types/Str.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | is "ẛ̣".WHAT, Str, "Strings are of type Str by default."; 6 | #?rakudo 1 skip ':nfg adverb NYI' 7 | is qq:nfg/ẛ̣/.WHAT, Str, ":nfg adverb on quoteforms results in Str."; 8 | 9 | #?rakudo.jvm todo "nqp::chars works on Java's chars: https://github.com/Raku/nqp/issues/783" 10 | is "ẛ̣".chars, 1, "Str.chars returns number of graphemes."; 11 | is "ẛ̣".ord, 0x1E9B, "Str.ord returns first NFC codepoint for NFG grapheme"; 12 | 13 | # vim: expandtab shiftwidth=4 14 | -------------------------------------------------------------------------------- /S16-filehandles/misc.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Util; 4 | 5 | plan 2; 6 | 7 | # https://github.com/Raku/old-issue-tracker/issues/4687 8 | { 9 | is_run 'say $*IN.words.unique', 10 | 'cat dog cat dog bird dog Snake snake Snake', 11 | { out => "(cat dog bird Snake snake)\n", err => '', status => 0 }, 12 | '$*IN.words.unique with no new line at the end must NOT hang'; 13 | } 14 | 15 | # https://github.com/Raku/old-issue-tracker/issues/3326 16 | { 17 | is_run 'say $*IN.get', 'Hello, World!', 18 | { out => "Hello, World!\n", err => '', status => 0 }, 19 | '.get from $*IN works correctly'; 20 | 21 | } 22 | 23 | # vim: expandtab shiftwidth=4 24 | -------------------------------------------------------------------------------- /S16-filehandles/unlink.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 3; 3 | 4 | # L 5 | # old: L 6 | 7 | sub nonce() { "unlink-t-testfile-" ~ 1000.rand } 8 | 9 | my $fn = "unlink-test-file" ~ nonce; 10 | 11 | # open, explicit close, unlink, test 12 | { 13 | my $fh = open($fn, :w); 14 | close $fh; 15 | 16 | ok $fn.IO ~~ :e, "open() created a tempfile"; 17 | ok(unlink($fn), "unlink() returned true"); 18 | ok $fn.IO !~~ :e, "unlink() actually deleted the tempfile"; 19 | } 20 | 21 | 22 | # vim: expandtab shiftwidth=4 23 | -------------------------------------------------------------------------------- /S16-io/cwd.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # L 4 | # see also S28-named-variables/cwd.t 5 | 6 | plan 3; 7 | 8 | isa-ok $*CWD, IO::Path; 9 | lives-ok { $*CWD.raku }, '$*CWD.raku works'; 10 | lives-ok { $*CWD.gist }, '$*CWD.gist works'; 11 | 12 | # vim: expandtab shiftwidth=4 13 | -------------------------------------------------------------------------------- /S16-io/newline.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 6; 4 | 5 | { 6 | use newline :lf; 7 | is "\n".encode('ascii'), Buf.new(0x0A), 'use newline :lf influences \n'; 8 | is Buf.new(0x0A).decode('ascii'), "\n", 'use newline :lf decodes to \n'; 9 | } 10 | { 11 | use newline :cr; 12 | is "\n".encode('ascii'), Buf.new(0x0D), 'use newline :cr influences \n'; 13 | is Buf.new(0x0D).decode('ascii'), "\n", 'use newline :cr decodes to \n'; 14 | } 15 | { 16 | use newline :crlf; 17 | is "\n".encode('ascii'), Buf.new(0xD, 0x0A), 'use newline :crlf influences \n'; 18 | is Buf.new(0xD, 0x0A).decode('ascii'), "\n", 'use newline :crlf decodes to \n'; 19 | } 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /S16-io/say-and-ref.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Util; 4 | 5 | plan 3; 6 | 7 | 8 | is_run q{my $a = [1, 2, 3]; say $a}, 9 | { 10 | out => "[1 2 3]\n", 11 | err => '', 12 | status => 0, 13 | }, 'Can say array ref'; 14 | 15 | is_run q{my $a = [1, 2, 3]; print $a}, 16 | { 17 | out => "1 2 3", 18 | err => '', 19 | status => 0, 20 | }, 'Can print array ref'; 21 | 22 | # https://github.com/Raku/old-issue-tracker/issues/2284 23 | is_run q{IO.say}, 24 | { 25 | out => "(IO)\n"; 26 | }, 'Can do IO.say'; 27 | 28 | # vim: expandtab shiftwidth=4 29 | -------------------------------------------------------------------------------- /S16-io/test-data: -------------------------------------------------------------------------------- 1 | Please do not remove this file, used by S16-io/basic-open.t 2 | Please don't change it either. 3 | This is a test line. 4 | -------------------------------------------------------------------------------- /S16-io/tmpdir.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add: 'packages/Test-Helpers'; 3 | use Test::Util; 4 | 5 | 6 | # L 7 | 8 | plan 9; 9 | 10 | isa-ok $*TMPDIR, IO::Path; 11 | lives-ok { $*TMPDIR.raku }, '$*TMPDIR.raku works'; 12 | lives-ok { $*TMPDIR.gist }, '$*TMPDIR.gist works'; 13 | 14 | isa-ok .tmpdir, IO::Path, "{.^name}.tmpdir returns IO::Path" 15 | for IO::Spec::Unix, IO::Spec::Win32, IO::Spec::Cygwin, IO::Spec::QNX; 16 | 17 | { 18 | my $before = $*TMPDIR; 19 | { 20 | temp $*TMPDIR = '/foo'.IO; 21 | is-path $*TMPDIR, '/foo'.IO, 'was able to `temp` $*TMPDIR'; 22 | } 23 | is-path $*TMPDIR, $before, 24 | '`temp`ed $*TMPDIR got restored to previous value'; 25 | } 26 | 27 | # vim: expandtab shiftwidth=4 28 | -------------------------------------------------------------------------------- /S16-unfiled/getpeername.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # old: L 4 | # L 5 | 6 | =begin pod 7 | 8 | IO.getpeername test 9 | 10 | =end pod 11 | 12 | plan 1; 13 | 14 | my $sock = IO::Socket::INET.connect('google.com', 80); 15 | #?rakudo todo "getpeername is not implemented yet" 16 | # It's better to remove try when the TODO passes. Though more testing would then be needed anyway, I guess. 17 | ok (try $sock.getpeername.defined), "IO::Socket::INet.getpeername works"; 18 | 19 | # vim: expandtab shiftwidth=4 20 | -------------------------------------------------------------------------------- /S17-channel/subscription-drain-in-react.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | # This test covers a hang due to the `.list` call below hanging when there was 6 | # a `whenever` subscribed to the Channel and we closed it. The bug vanished if 7 | # wrapping it into a `start` or similar to do a timeout, so seems sensitive to 8 | # the thread pool contents, so was placed into its own test file. 9 | react { 10 | my $c = Channel.new; 11 | whenever $c { }; 12 | $c.close; 13 | for $c.list { } 14 | } 15 | pass "No hang when we close/drain a Channel that is subscribed to in the same react"; 16 | 17 | # vim: expandtab shiftwidth=4 18 | -------------------------------------------------------------------------------- /S17-lowlevel/cas-loop-int.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 7; 3 | 4 | # Basic sanity 5 | { 6 | my atomicint $value = 21; 7 | my int $was; 8 | ok cas($value, { $was = $_; 2 * $_ }) == 42, 9 | 'Looping form of CAS returns what was installed'; 10 | ok $was == 21, 'The block was called with the original value'; 11 | is $value, 42, 'The value was updated with the correct value'; 12 | } 13 | 14 | # Make sure we really do it atomic. 15 | for 1..4 -> $attempt { 16 | my $total = 0; 17 | await start { 18 | for 1..10000 -> $i { 19 | cas $total, -> $cur { $cur + $i } 20 | } 21 | } xx 4; 22 | 23 | is $total, 4 * [+](1..10000), 24 | "Block form of CAS on integer lexical works ($attempt)"; 25 | } 26 | 27 | # vim: expandtab shiftwidth=4 28 | -------------------------------------------------------------------------------- /S17-lowlevel/thread-start-join-stress.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | # https://github.com/Raku/old-issue-tracker/issues/4506 6 | for ^1000 { Thread.start(-> {}).join; } 7 | pass "Can start/join 1000 threads without running out of handles, etc."; 8 | 9 | # vim: expandtab shiftwidth=4 10 | -------------------------------------------------------------------------------- /S17-procasync/many-processes-no-close-stdin.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Util; 4 | 5 | plan 1; 6 | 7 | is_run 「 8 | my $prog = $*DISTRO.is-win ?? 'cmd' !! 'cat'; 9 | my @target = $*DISTRO.is-win ?? «/c ""» !! '/dev/null'; 10 | 11 | for ^1000 { 12 | my $proc = Proc::Async.new($prog, |@target, :w); 13 | 14 | my $promise = $proc.start; 15 | await $promise; 16 | } 17 | 18 | print 'pass' 19 | 」, {:out, :err(''), :0status}, 'made it to the end'; 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /S17-procasync/no-runaway-file-limit.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Util; 4 | 5 | plan 1; 6 | 7 | # https://github.com/Raku/old-issue-tracker/issues/4403 8 | is_run 「 9 | my $prog = $*DISTRO.is-win ?? 'cmd' !! 'cat'; 10 | my @target = $*DISTRO.is-win ?? «/c ""» !! '/dev/null'; 11 | for ^1000 { 12 | my $proc = Proc::Async.new($prog, |@target, :w); 13 | $proc.stdout.tap(-> $data {}); 14 | my $p = $proc.start; 15 | $proc.close-stdin; 16 | await $p; 17 | } 18 | print 'pass' 19 | 」, {:out, :err(''), :0status}, 'made it to the end'; 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /S17-procasync/windows-print-raw-args.raku: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env raku 2 | 3 | use NativeCall; 4 | 5 | # The following blows up with: 6 | # Malformed UTF-16; odd number of bytes (1) 7 | # in block GetCommandLineW 8 | #sub GetCommandLineW() returns Str is encoded('utf16') is rw is native('Kernel32') { * } 9 | 10 | sub GetCommandLineW() returns CArray[uint8] is rw is native('Kernel32') { * } 11 | sub get-commandline() { 12 | my @nat-arr := GetCommandLineW(); 13 | my @arr; 14 | for 0 .. * -> $i, $j { 15 | last if @nat-arr[$i] == @nat-arr[$j] == 0; 16 | @arr.push: @nat-arr[$i], @nat-arr[$j]; 17 | } 18 | return Blob.new(@arr).decode('utf16'); 19 | } 20 | 21 | say get-commandline(); 22 | -------------------------------------------------------------------------------- /S17-promise/lock-async-stress.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | { 6 | my $n = 10000; 7 | my $n-threads = 4; 8 | my $target-lock = Lock::Async.new; 9 | my @target; 10 | await start { 11 | for ^$n -> $i { 12 | $target-lock.protect: { 13 | push @target, $i; 14 | } 15 | } 16 | } xx $n-threads; 17 | is [+](@target), $n-threads * [+](^$n), 18 | 'Lock provides mutual exclusion when pushing to array'; 19 | } 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /S17-promise/lock-async-stress2.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | { 6 | my $n = 10000; 7 | my $n-threads = 4; 8 | my $target = 0; 9 | my $target-lock = Lock::Async.new; 10 | await start { 11 | for ^$n -> $i { 12 | $target-lock.protect: { 13 | $target += $i; 14 | } 15 | } 16 | } xx $n-threads; 17 | is $target, $n-threads * [+](^$n), 18 | 'Lock::Async provides mutual exclusion when doing +='; 19 | } 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /S17-promise/stress.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | # https://github.com/Raku/old-issue-tracker/issues/3690 6 | is ([+] await do for ^8 { 7 | start { 8 | my $i; 9 | for ^1_000_000 { $i++; } 10 | $i 11 | } 12 | }), 8_000_000, 'Large number of iterations in threads work fine'; 13 | 14 | # vim: expandtab shiftwidth=4 15 | -------------------------------------------------------------------------------- /S17-scheduler/times.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | # real scheduling here 6 | my $name = $*SCHEDULER.^name; 7 | 8 | { 9 | my $tracker = 0; 10 | my $c = $*SCHEDULER.cue({ cas $tracker, {.succ} }, :times(10)); 11 | isa-ok( $c, Cancellation ); 12 | sleep 3; 13 | is $tracker, 10, "Cue on $name with :times(10)"; 14 | LEAVE .cancel with $c; 15 | } 16 | 17 | # fake scheduling from here on out 18 | $*SCHEDULER = CurrentThreadScheduler.new; 19 | $name = $*SCHEDULER.^name; 20 | 21 | { 22 | my $tracker; 23 | my $c = $*SCHEDULER.cue({ $tracker++ }, :times(10)); 24 | ok $c.can("cancel"), 'can we cancel'; 25 | is $tracker, 10, "Cue on $name with :times(10)"; 26 | LEAVE .cancel with $c; 27 | } 28 | 29 | # vim: expandtab shiftwidth=4 30 | -------------------------------------------------------------------------------- /S17-supply/Seq.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 9; 4 | 5 | is-deeply Supply.list, (Supply,).Seq, 'can list a Supply type object'; 6 | 7 | for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER { 8 | diag "**** scheduling with {$*SCHEDULER.WHAT.raku}"; 9 | 10 | my @a; 11 | for Supply.from-list(2..6).Seq { @a.push($_) }; 12 | is-deeply @a, [2..6], "Supply.list works in for"; 13 | my @b = Supply.from-list(42..50).Seq; 14 | is-deeply @b, [42..50], "Supply.list can be stored in array"; 15 | isa-ok Supply.from-list(2..6) .Seq, Seq, "Supply.Seq should return a Seq"; 16 | isa-ok Supply.from-list(42..50) .Seq, Seq, "Supply.Seq should return a Seq"; 17 | } 18 | 19 | # vim: expandtab shiftwidth=4 20 | -------------------------------------------------------------------------------- /S17-supply/do.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Tap; 4 | 5 | plan 5; 6 | 7 | dies-ok { Supply.do({...}) }, 'can not be called as a class method'; 8 | 9 | for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER { 10 | diag "**** scheduling with {$*SCHEDULER.WHAT.raku}"; 11 | 12 | { 13 | my $seen; 14 | tap-ok Supply.from-list(1..10).do( {$seen++} ), 15 | [1..10], ".do worked"; 16 | is $seen, 10, "did the side effect work"; 17 | } 18 | } 19 | 20 | # vim: expandtab shiftwidth=4 21 | -------------------------------------------------------------------------------- /S17-supply/grab.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Tap; 4 | 5 | plan 5; 6 | 7 | dies-ok { Supply.grab }, 'can not be called as a class method'; 8 | 9 | for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER { 10 | diag "**** scheduling with {$*SCHEDULER.WHAT.raku}"; 11 | 12 | tap-ok Supply.from-list(1..10).grab( {.reverse} ), [10...1], "we can reverse"; 13 | tap-ok Supply.from-list(1..10).grab( {[min] $_} ), [1], "we can find the min"; 14 | } 15 | 16 | # vim: expandtab shiftwidth=4 17 | -------------------------------------------------------------------------------- /S17-supply/list.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add: 'packages/Test-Helpers'; 3 | use Test::Util; 4 | 5 | plan 9; 6 | 7 | is-eqv Supply.list, (Supply,), 'can list a Supply type object'; 8 | 9 | for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER { 10 | diag "**** scheduling with {$*SCHEDULER.WHAT.raku}"; 11 | 12 | my @a; 13 | for Supply.from-list(2..6).list { @a.push($_) }; 14 | is-deeply @a, [2..6], "Supply.list works in for"; 15 | my @b = Supply.from-list(42..50).list; 16 | is-deeply @b, [42..50], "Supply.list can be stored in array"; 17 | isa-ok Supply.from-list(2..6) .list, List, "Supply.list should return a List"; 18 | isa-ok Supply.from-list(42..50) .list, List, "Supply.list should return a List"; 19 | } 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /S17-supply/map.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Tap; 4 | 5 | plan 7; 6 | 7 | dies-ok { Supply.map({...}) }, 'can not be called as a class method'; 8 | 9 | for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER { 10 | diag "**** scheduling with {$*SCHEDULER.WHAT.raku}"; 11 | 12 | tap-ok Supply.from-list(1..10).map( * * 5 ), 13 | [5,10,15,20,25,30,35,40,45,50], 14 | "mapping tap with single values works"; 15 | 16 | tap-ok Supply.from-list(1..5).map( {[$_]} ), 17 | [[1],[2],[3],[4],[5]], "On demand publish with arrays will not flatten them"; 18 | 19 | tap-ok Supply.from-list( [1,2],[3,4,5] ).map( {.reverse.Str} ), 20 | ["2 1", "5 4 3"], "Same if we get lists"; 21 | } 22 | 23 | # vim: expandtab shiftwidth=4 24 | -------------------------------------------------------------------------------- /S17-supply/max.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Tap; 4 | 5 | plan 10; 6 | 7 | dies-ok { Supply.max }, 'can not be called as a class method'; 8 | dies-ok { Supply.new.max(23) }, 'must be code if specified'; 9 | 10 | for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER { 11 | diag "**** scheduling with {$*SCHEDULER.WHAT.raku}"; 12 | 13 | tap-ok Supply.from-list(1..10).max, [1..10], 14 | "ascending max works"; 15 | tap-ok Supply.from-list(10...1).max, [10], 16 | "descending max works"; 17 | tap-ok Supply.from-list(flat("a".."e","A".."E")).max(*.uc), [], 18 | "ascending alpha works"; 19 | tap-ok Supply.from-list(flat("E"..."A","e".."a")).max(*.lc), ["E"], 20 | "descending alpha works"; 21 | } 22 | 23 | # vim: expandtab shiftwidth=4 24 | -------------------------------------------------------------------------------- /S17-supply/min.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Tap; 4 | 5 | plan 10; 6 | 7 | dies-ok { Supply.min }, 'can not be called as a class method'; 8 | dies-ok { Supply.new.min(23) }, 'must be code if specified'; 9 | 10 | for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER { 11 | diag "**** scheduling with {$*SCHEDULER.WHAT.raku}"; 12 | 13 | tap-ok Supply.from-list(1..10).min, [1], 14 | "ascending min works"; 15 | tap-ok Supply.from-list(10...1).min, [10...1], 16 | "descending min works"; 17 | tap-ok Supply.from-list(("a".."e").Slip,("A".."E").Slip).min(*.uc), ["a"], 18 | "ascending alpha works"; 19 | tap-ok Supply.from-list("E"..."A",("e".."a").Slip).min(*.lc), [], 20 | "descending alpha works"; 21 | } 22 | 23 | # vim: expandtab shiftwidth=4 24 | -------------------------------------------------------------------------------- /S17-supply/on-demand.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Tap; 4 | 5 | plan 7; 6 | 7 | dies-ok { Supplier.new.Supply.on-demand(1..10) }, 'can not be called as an instance method'; 8 | 9 | for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER { 10 | diag "**** scheduling with {$*SCHEDULER.WHAT.raku}"; 11 | 12 | { 13 | my $s = Supply.on-demand( -> \s { s.emit($_) for 1..10; s.done } ); 14 | tap-ok $s, [1..10], :!live, "On demand publish worked"; 15 | tap-ok $s, [1..10], :!live, "Second tap gets all the values"; 16 | 17 | ok $s.Supply === $s, '.Supply on a Supply is a noop'; 18 | } 19 | } 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /S17-supply/return-in-tap.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 1; 3 | 4 | # This test does many iterations, to catch a couple of problems that showed up 5 | # when using code like this: 6 | # * A GC failure due to locks being freed while still locked 7 | # * A JIT bug 8 | 9 | sub dying($in) { 10 | supply { 11 | whenever $in { 12 | die "oh no"; 13 | } 14 | } 15 | } 16 | 17 | my $caught = 0; 18 | 19 | sub try-it() { 20 | my $fake-in = Supplier.new; 21 | dying($fake-in.Supply).tap: 22 | quit => -> $exception { 23 | $caught++; 24 | return; 25 | }; 26 | $fake-in.emit("XXX"); 27 | } 28 | 29 | for ^1000 { 30 | try-it; 31 | } 32 | 33 | is $caught, 1000, 'return in a Supply quit handler works fine'; 34 | 35 | # vim: expandtab shiftwidth=4 36 | -------------------------------------------------------------------------------- /S17-supply/reverse.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Tap; 4 | 5 | plan 3; 6 | 7 | dies-ok { Supply.reverse }, 'can not be called as a class method'; 8 | 9 | for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER { 10 | diag "**** scheduling with {$*SCHEDULER.WHAT.raku}"; 11 | 12 | tap-ok Supply.from-list(1..10).reverse, [10...1], "we can reverse"; 13 | } 14 | 15 | # vim: expandtab shiftwidth=4 16 | -------------------------------------------------------------------------------- /S17-supply/rotate.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Tap; 4 | 5 | plan 11; 6 | 7 | dies-ok { Supply.rotate }, 'can not be called as a class method'; 8 | 9 | for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER { 10 | diag "**** scheduling with {$*SCHEDULER.WHAT.raku}"; 11 | 12 | tap-ok Supply.from-list(1..5).rotate, [2,3,4,5,1], "we can rotate"; 13 | tap-ok Supply.from-list(1..5).rotate(3), [4,5,1,2,3], "we can rotate(3)"; 14 | tap-ok Supply.from-list(1..5).rotate(8), [4,5,1,2,3], "we can rotate(8)"; 15 | tap-ok Supply.from-list(1..5).rotate(-3), [3,4,5,1,2], "we can rotate(-3)"; 16 | tap-ok Supply.from-list(1..5).rotate(0), [1,2,3,4,5], "we can rotate(0)"; 17 | } 18 | 19 | # vim: expandtab shiftwidth=4 20 | -------------------------------------------------------------------------------- /S17-supply/skip.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Tap; 4 | 5 | plan 7; 6 | 7 | throws-like 「react whenever ^42 .Supply.skip: "foo" {}」, X::Str::Numeric, 8 | 'cannot have "foo" skip'; 9 | 10 | for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER { 11 | diag "**** scheduling with {$*SCHEDULER.WHAT.raku}"; 12 | 13 | tap-ok Supply.from-list(1..4).skip, [2,3,4], "skip without argument works"; 14 | tap-ok Supply.from-list(1..10).skip(5), [6,7,8,9,10], "skip five works"; 15 | tap-ok Supply.from-list(1..10).skip(15), [], "skip 15 works"; 16 | } 17 | 18 | # vim: expandtab shiftwidth=4 19 | -------------------------------------------------------------------------------- /S17-supply/snip.t: -------------------------------------------------------------------------------- 1 | use v6.e.PREVIEW; 2 | use Test; 3 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 4 | use Test::Tap; 5 | 6 | plan 7; 7 | 8 | dies-ok { Supply.snip(1000) }, 'can not be called as a class method'; 9 | 10 | for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER { 11 | diag "**** scheduling with {$*SCHEDULER.WHAT.raku}"; 12 | 13 | tap-ok Supply.from-list(1..14).snip(*>9), 14 | [(1,2,3,4,5,6,7,8,9),(10,11,12,13,14)], 15 | "we can snip with a single test"; 16 | 17 | tap-ok Supply.from-list(1..14).snip(*>9, *>11), 18 | [(1,2,3,4,5,6,7,8,9),(10,11),(12,13,14)], 19 | "we can snip with two tests"; 20 | 21 | tap-ok Supply.from-list("a","b","c",1,2,3).snip(Int), 22 | [("a","b","c"),(1,2,3)], 23 | "we can snip with a type object"; 24 | } 25 | 26 | # vim: expandtab shiftwidth=4 27 | -------------------------------------------------------------------------------- /S17-supply/sort.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Tap; 4 | use Test::Util; 5 | 6 | plan 7; 7 | 8 | is-eqv Supply.sort, (Supply,).Seq, 'can sort a Supply type object'; 9 | 10 | for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER { 11 | diag "**** scheduling with {$*SCHEDULER.WHAT.raku}"; 12 | 13 | tap-ok Supply.from-list(10...1).sort, [1..10], "we can sort numbers"; 14 | tap-ok Supply.from-list("z"..."a").sort, ["a" .. "z"], "we can sort strings"; 15 | tap-ok Supply.from-list(flat("a".."d", "A" .. "D")).sort( { 16 | $^a.lc cmp $^b.lc || $^b cmp $^a 17 | } ), [], "we can sort in special ways"; 18 | } 19 | 20 | # vim: expandtab shiftwidth=4 21 | -------------------------------------------------------------------------------- /S19-command-line/help.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Util; 4 | 5 | plan 1; 6 | 7 | is_run Str, :args['--help'], 8 | { 9 | out => { .chars > 20 }, 10 | err => '', 11 | status => 0, 12 | }, 13 | '--help tells us something, and returns 0'; 14 | 15 | 16 | # vim: expandtab shiftwidth=4 17 | -------------------------------------------------------------------------------- /S19-command-line/repl.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Util; 4 | 5 | plan 1; 6 | 7 | # Sanity check that the repl is working at all. 8 | my $cmd = $*DISTRO.is-win 9 | ?? "echo exit(42) | $*EXECUTABLE 1>&2" 10 | !! "echo 'exit(42)' | $*EXECUTABLE >/dev/null 2>&1"; 11 | is shell($cmd).exitcode, 42, 'exit(42) in executed REPL got run'; 12 | 13 | # Note: implementations should implement their own, more comprehensive, REPL 14 | # tests. For example, Rakudo implementation includes them in its t/ test suite 15 | 16 | # vim: expandtab shiftwidth=4 17 | -------------------------------------------------------------------------------- /S24-testing/0-compile.t: -------------------------------------------------------------------------------- 1 | # Checking that testing is sane: Test.rakumod 2 | 3 | use Test; 4 | 5 | plan 1; 6 | 7 | my $x = '0'; 8 | ok $x == $x; 9 | 10 | # vim: expandtab shiftwidth=4 11 | -------------------------------------------------------------------------------- /S24-testing/11-plan-skip-all.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan skip-all => "Testing skippage of `plan skip-all`"; 3 | 4 | plan 1; 5 | flunk "`plan skip-all` did not exit the test file"; 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /S24-testing/13-cmp-ok.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Util; 4 | 5 | plan 2; 6 | 7 | # Some things don't stringify well, so cmp-ok should show something better 8 | # for them, like .gist or .raku: 9 | is_run 「use Test; cmp-ok 'foo', '~~', class { 10 | method raku { 'meowbar' } 11 | method gist { 'meowbar' } 12 | method Str { die 'test failed' } 13 | }.new」, {:err(/meowbar/)}, 14 | 'cmp-ok makes $expected more presentable than just its .Str'; 15 | 16 | cmp-ok Mu, '=:=', Mu, 'can use cmp-ok with `=:=` operator'; 17 | 18 | # vim: expandtab shiftwidth=4 19 | -------------------------------------------------------------------------------- /S24-testing/14-like-unlike.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add: 'packages/Test-Helpers'; 3 | use Test::Util; 4 | 5 | plan 4; 6 | 7 | # https://github.com/rakudo/rakudo/issues/1567 8 | like 42, /42/, '`like` can accept non-Str objects (Int)'; 9 | like class { method Str { 'foo' } }, /foo/, 10 | '`like` can accept non-Str objects (custom)'; 11 | 12 | # https://github.com/rakudo/rakudo/issues/1567 13 | unlike 42, /43/, '`unlike` can accept non-Str objects (Int)'; 14 | unlike class { method Str { 'foo' } }, /bar/, 15 | '`unlike` can accept non-Str objects (custom)'; 16 | 17 | # vim: expandtab shiftwidth=4 18 | -------------------------------------------------------------------------------- /S24-testing/6-done_testing.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | pass; 3 | ok 1; 4 | ok 0,:todo(1); 5 | done-testing; 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /S24-testing/test-data/README: -------------------------------------------------------------------------------- 1 | S24-testing/test-data/README 2 | 3 | This directory exists to hold files which are used 4 | by tests in S24-testing. 5 | The files in this directorey are not supposed to 6 | be run directly. 7 | -------------------------------------------------------------------------------- /S24-testing/test-data/line-number-bar-ok.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | sub foo-ok() is test-assertion { flunk "foo-ok" } 7 | sub bar-ok() is test-assertion { foo-ok } 8 | 9 | ## the following code should stay at line number 12 10 | ## if you move it to another line, please adjust 11 | ## the line number in S24-testing/line-numbers.t 12 | bar-ok; 13 | -------------------------------------------------------------------------------- /S24-testing/test-data/line-number-cmp-ok.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | ## the following code should stay at line number 9 7 | ## if you move it to another line, please adjust 8 | ## the line number in S24-testing/line-numbers.t 9 | cmp-ok 'foo', 'eq', 'bar'; 10 | -------------------------------------------------------------------------------- /S24-testing/test-data/line-number-dies-ok.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | ## the following code should stay at line number 9 7 | ## if you move it to another line, please adjust 8 | ## the line number in S24-testing/line-numbers.t 9 | dies-ok { 1 }; 10 | -------------------------------------------------------------------------------- /S24-testing/test-data/line-number-eval-dies-ok.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | ## the following code should stay at line number 9 7 | ## if you move it to another line, please adjust 8 | ## the line number in S24-testing/line-numbers.t 9 | eval-dies-ok '1'; 10 | -------------------------------------------------------------------------------- /S24-testing/test-data/line-number-eval-lives-ok.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | ## the following code should stay at line number 9 7 | ## if you move it to another line, please adjust 8 | ## the line number in S24-testing/line-numbers.t 9 | eval-lives-ok 'die'; 10 | -------------------------------------------------------------------------------- /S24-testing/test-data/line-number-foo-ok.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | sub foo-ok() is test-assertion { flunk "foo-ok" } 7 | 8 | ## the following code should stay at line number 11 9 | ## if you move it to another line, please adjust 10 | ## the line number in S24-testing/line-numbers.t 11 | foo-ok; 12 | -------------------------------------------------------------------------------- /S24-testing/test-data/line-number-is-approx.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | ## the following code should stay at line number 9 7 | ## if you move it to another line, please adjust 8 | ## the line number in S24-testing/line-numbers.t 9 | is-approx 1, 2; 10 | -------------------------------------------------------------------------------- /S24-testing/test-data/line-number-is-deeply.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | ## the following code should stay at line number 9 7 | ## if you move it to another line, please adjust 8 | ## the line number in S24-testing/line-numbers.t 9 | is-deeply , ; 10 | -------------------------------------------------------------------------------- /S24-testing/test-data/line-number-is.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | ## the following code should stay at line number 9 7 | ## if you move it to another line, please adjust 8 | ## the line number in S24-testing/line-numbers.t 9 | is 'foo', 'bar'; 10 | -------------------------------------------------------------------------------- /S24-testing/test-data/line-number-isa-ok.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | ## the following code should stay at line number 9 7 | ## if you move it to another line, please adjust 8 | ## the line number in S24-testing/line-numbers.t 9 | isa-ok Str, Num; 10 | -------------------------------------------------------------------------------- /S24-testing/test-data/line-number-isnt.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | ## the following code should stay at line number 9 7 | ## if you move it to another line, please adjust 8 | ## the line number in S24-testing/line-numbers.t 9 | isnt 'foo', 'foo'; 10 | -------------------------------------------------------------------------------- /S24-testing/test-data/line-number-lives-ok.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | ## the following code should stay at line number 9 7 | ## if you move it to another line, please adjust 8 | ## the line number in S24-testing/line-numbers.t 9 | lives-ok { die }; 10 | -------------------------------------------------------------------------------- /S24-testing/test-data/line-number-nok.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | ## the following code should stay at line number 9 7 | ## if you move it to another line, please adjust 8 | ## the line number in S24-testing/line-numbers.t 9 | nok 1; 10 | -------------------------------------------------------------------------------- /S24-testing/test-data/line-number-ok.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | ## the following code should stay at line number 9 7 | ## if you move it to another line, please adjust 8 | ## the line number in S24-testing/line-numbers.t 9 | ok 0; 10 | -------------------------------------------------------------------------------- /S24-testing/test-data/line-number-throws-like.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | ## the following code should stay at line number 9 7 | ## if you move it to another line, please adjust 8 | ## the line number in S24-testing/line-numbers.t 9 | throws-like { X::Syntax::Confused }, X::AdHoc; 10 | -------------------------------------------------------------------------------- /S24-testing/test-data/todo-passed.txt: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 1; 5 | 6 | ## this file is executed from S24-testing/3-output.t 7 | ## here is a TODO test that passes 8 | todo("testing output for passing todo test"); ok 1, "test passes"; 9 | -------------------------------------------------------------------------------- /S24-testing/use_ok_test.rakumod: -------------------------------------------------------------------------------- 1 | unit module use_ok_test:ver<0.0.1>; 2 | 3 | sub it_worked { 1 } 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /S26-documentation/10-doc-cli.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Util; 4 | 5 | plan 2; 6 | 7 | my $POD = Q:to<--END-->; 8 | =begin pod 9 | 10 | =head1 Some Heading 11 | 12 | Some Text 13 | 14 | =end pod 15 | --END-- 16 | 17 | is_run :compiler-args['--doc'], $POD, { 18 | out => rx/'Some Heading'/ & rx/'Some Text'/, err => '', 19 | }, 'basic --doc sanity'; 20 | 21 | my $POD2 = $POD ~ Q:to<--END-->; 22 | 23 | DOC INIT { say 'alive'; exit }; 24 | --END-- 25 | 26 | is_run :compiler-args['--doc'], $POD2 , { 27 | out => rx/'alive'/, err => '', 28 | }, 'basic --doc with DOC INIT block'; 29 | 30 | # vim: expandtab shiftwidth=4 31 | -------------------------------------------------------------------------------- /S26-documentation/module-comment.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | #| before 6 | unit module M; 7 | #= after 8 | 9 | is M.WHY, "before\nafter", 'module + semicolon trailing comment'; 10 | 11 | # vim: expandtab shiftwidth=4 12 | -------------------------------------------------------------------------------- /S26-documentation/multiline-leading.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | #| More 6 | #| Than 7 | #| One 8 | #| Line 9 | class App { 10 | #| Does 11 | #| Stuff 12 | method do-stuff( 13 | #| Param 14 | #| One 15 | Str $param1, 16 | 17 | #| Param 18 | #| Two 19 | Str $param2 20 | ) {} 21 | } 22 | 23 | my $method = App.^find_method('do-stuff'); 24 | is ~App.WHY, "More Than One Line", "multiline-leading App.WHY"; 25 | is ~$method.WHY, "Does Stuff", "multiline-leading method.WHY"; 26 | 27 | my @params = $method.signature.params; 28 | 29 | is ~@params[1].WHY, 'Param One', "method.signature WHY param one"; 30 | is ~@params[2].WHY, 'Param Two', "method.signature WHY param two"; 31 | 32 | # vim: expandtab shiftwidth=4 33 | -------------------------------------------------------------------------------- /S26-documentation/multiline-trailing.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 2; 4 | 5 | class App { 6 | #= More 7 | #= Than 8 | #= One 9 | #= Line 10 | method do-stuff() {} 11 | #= Does 12 | #= Stuff 13 | } 14 | 15 | is ~App.WHY, "More Than One Line"; 16 | is ~App.^find_method('do-stuff').WHY, "Does Stuff"; 17 | 18 | # vim: expandtab shiftwidth=4 19 | -------------------------------------------------------------------------------- /S28-named-variables/cwd.t: -------------------------------------------------------------------------------- 1 | # L 2 | # See also S16-io/cwd.t 3 | 4 | use Test; 5 | 6 | plan 2; 7 | 8 | # $*CWD is currently just a string 9 | 10 | ok( defined($*CWD), 'we have something in our $CWD'); 11 | 12 | # check if there is a t subfolder 13 | 14 | my $subfolder_exists = 0; 15 | if "$*CWD/t".IO ~~ :e { 16 | $subfolder_exists = 1; 17 | }#if 18 | ok( $subfolder_exists, 'we have a "t" subfolder'); 19 | 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /S28-named-variables/init-instant.t: -------------------------------------------------------------------------------- 1 | # L 2 | 3 | use Test; 4 | 5 | plan 3; 6 | 7 | my $manual-init-time = INIT now ; 8 | 9 | ok defined($*INIT-INSTANT), '$*INIT-INSTANT is defined'; 10 | isa-ok $*INIT-INSTANT, Instant, " ... and is-a type Instant"; 11 | 12 | # Check that $*INIT-INSTANT refers to an instant that occurred 13 | # within a few seconds of our manually sampled init time 14 | is-approx $*INIT-INSTANT, $manual-init-time, :abs-tol(5 * (%*ENV//1)), 15 | " ... of approximately correct value"; 16 | 17 | # vim: expandtab shiftwidth=4 18 | -------------------------------------------------------------------------------- /S28-named-variables/slangs.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | # L 6 | 7 | ok(defined($~MAIN), '$~MAIN is defined'); 8 | ok(defined($~Quote), '$~Quote is defined'); 9 | ok(defined($~Regex), '$~Regex is defined'); 10 | ok(defined($~P5Regex), '$~P5Regex is defined'); 11 | 12 | # vim: expandtab shiftwidth=4 13 | -------------------------------------------------------------------------------- /S29-any/cmp.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 6; 4 | 5 | # L 6 | 7 | is('a' cmp 'a', Order::Same, 'a is equal to a'); 8 | is('a' cmp 'b', Order::Less, 'a is less than b'); 9 | is('b' cmp 'a', Order::More, 'b is greater than a'); 10 | 11 | is(3 cmp 3, Order::Same, '3 cmp 3 is 0'); 12 | is(2 cmp 3, Order::Less, '2 cmp 3 is -1'); 13 | is(3 cmp 4, Order::Less, '3 cmp 4 is -1'); 14 | 15 | # vim: expandtab shiftwidth=4 16 | -------------------------------------------------------------------------------- /S29-context/exit-in-if.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 1; 3 | 4 | # L 5 | 6 | # This test is primarily aimed at PIL2JS. 7 | # In conditionals, or, to be more exact, in all things using PIL2JS.cps2normal, 8 | # exit() did call all END blocks, but the control flow was resumed afterwards. 9 | # This is now fixed, but it's still good to have a test for it. 10 | 11 | 12 | if 1 { 13 | pass; 14 | exit; 15 | } 16 | 17 | ok 0, "exit() in if didn't work"; 18 | 19 | # vim: expandtab shiftwidth=4 20 | -------------------------------------------------------------------------------- /S29-context/exit.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add("packages/Test-Helpers"); 3 | use Test::Util; 4 | 5 | plan 3; 6 | 7 | # L 8 | 9 | is_run 'say 3; exit; say 5', 10 | { out => "3\n", err => "", status => 0 }, 11 | 'bare exit; works'; 12 | 13 | is_run 'say 3; exit 5; say 5', 14 | { out => "3\n", err => "", status => 5 }, 15 | 'exit 5; works'; 16 | 17 | is_run 'say 3; try { exit 5 }; say 5', 18 | { out => "3\n", err => "", status => 5 }, 19 | 'try-block does not catch exit exceptions'; 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /S32-basics/pairup.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add: 'packages/Test-Helpers'; 3 | use Test::Util; 4 | 5 | plan 6; 6 | 7 | { 8 | my @nums = 1..6; 9 | is-eqv Any.pairup, ().Seq, 'pairup on a :U invocant returns an empty Seq'; 10 | is-eqv @nums.pairup, (1 => 2, 3 => 4, 5 => 6).Seq, 11 | 'pairup on a :D invocant'; 12 | my %h = @nums.pairup; 13 | is(@nums.pairup.elems, 3, 'pairup returns correct list size'); 14 | is-deeply(%h.keys.sort, ('1', '3', '5'), 'hash constructed from pairup has correct keys'); 15 | is-deeply(%h.values.sort, (2, 4, 6), 'hash constructed from pairup has correct values'); 16 | @nums.push(7); 17 | throws-like 「my @ = @nums.pairup」, X::Pairup::OddNumber, 18 | 'pairup on odd numbered list size throws'; 19 | } 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /S32-container/cat.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 6; 4 | 5 | # L 6 | 7 | =begin pod 8 | 9 | Tests of 10 | 11 | our Lazy multi Container::cat( **@list ); 12 | 13 | =end pod 14 | 15 | #?rakudo 6 skip 'cat NYI' 16 | 17 | ok(cat() eqv (), 'cat null identity'); 18 | 19 | ok(cat(1) eqv (1,), 'cat scalar identity'); 20 | 21 | ok(cat(1..3) eqv 1..3, 'cat list identity'); 22 | 23 | ok(cat([1..3]) eqv 1..3, 'cat array identity'); 24 | 25 | # These below work. Just waiting on eqv. 26 | 27 | ok(cat({'a'=>1,'b'=>2,'c'=>3}) eqv ('a'=>1, 'b'=>2, 'c'=>3), 28 | 'cat hash identity'); 29 | 30 | ok(cat((); 1; 2..4; [5..7], {'a'=>1,'b'=>2}) eqv (1..7, 'a'=>1, 'b'=>2), 31 | 'basic cat'); 32 | 33 | # vim: expandtab shiftwidth=4 34 | -------------------------------------------------------------------------------- /S32-hash/antipairs.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # L 4 | 5 | plan 5; 6 | 7 | { 8 | my %h = a => 'b', c => 'd'; 9 | isa-ok %h.antipairs, Seq, 'Hash.antipairs returns a Seq'; 10 | is-deeply %h.antipairs.sort.list, (b => 'a', d => 'c'), 'simple Hash.antipairs works'; 11 | is-deeply %h, { a => 'b', c => 'd' }, 'original remains unchanged'; 12 | } 13 | 14 | { 15 | # with lists 16 | my %h = a => , d => 'e'; 17 | is-deeply %h.antipairs.sort.list, ( => 'a', e => 'd'), 18 | 'Hash.antipairs does not flatten list values'; 19 | is-deeply %h, {a => , d => 'e'}, 'original remains unchanged'; 20 | } 21 | 22 | # vim: expandtab shiftwidth=4 23 | -------------------------------------------------------------------------------- /S32-hash/invert.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # L 4 | 5 | plan 5; 6 | 7 | { 8 | my %h = a => 'b', c => 'd'; 9 | isa-ok %h.invert, Seq, 'Hash.invert returns a Seq'; 10 | is-deeply %h.invert.sort.list, (b => 'a', d => 'c'), 'simple Hash.invert works'; 11 | is-deeply %h, { a => 'b', c => 'd' }, 'original remains unchanged'; 12 | } 13 | 14 | { 15 | # with lists 16 | my %h = a => , d => 'e'; 17 | is-deeply %h.invert.sort.list, (b => 'a', c => 'a', e => 'd'), 18 | 'Hash.invert flattens list values'; 19 | is-deeply %h, {a => , d => 'e'}, 'original remains unchanged'; 20 | } 21 | 22 | # vim: expandtab shiftwidth=4 23 | -------------------------------------------------------------------------------- /S32-io/empty.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raku/roast/3549a55760b21222198223238b5fd84a3a708681/S32-io/empty.txt -------------------------------------------------------------------------------- /S32-io/native-descriptor.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | ok $*IN.native-descriptor >= 0, '$*IN has a naitve descriptor'; 6 | ok $*OUT.native-descriptor >= 0, '$*OUT has a naitve descriptor'; 7 | ok $*ERR.native-descriptor >= 0, '$*ERR has a naitve descriptor'; 8 | 9 | my $path = "io-native-descriptor-testfile"; 10 | given open($path, :w) { 11 | ok .native-descriptor >= 0, 'file handle has a native descriptor'; 12 | .close; 13 | unlink $path; 14 | } 15 | 16 | # vim: expandtab shiftwidth=4 17 | -------------------------------------------------------------------------------- /S32-io/other-stress.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add: 'packages/Test-Helpers'; 3 | use Test::Util; 4 | 5 | plan 60; 6 | 7 | # https://github.com/Raku/old-issue-tracker/issues/3120 8 | for 1..12 -> $x { 9 | for map { 2**$x - 1 }, ^5 { 10 | ok( get_out("say 1 x $_,q|—|", '') ~~ /^1+\—\s*$/, "Test for $_ bytes + utf8 char"); 11 | } 12 | } 13 | 14 | # vim: expandtab shiftwidth=4 15 | -------------------------------------------------------------------------------- /S32-io/other.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | # https://github.com/rakudo/rakudo/commit/dd4dfb14d3 6 | is-deeply (quietly IO::Special.Str), '', 'IO::Special:U.Str does not crash'; 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /S32-io/pi.txt: -------------------------------------------------------------------------------- 1 | 1234567890 2 | -------------------------------------------------------------------------------- /S32-io/utf16-test/sample-UTF-16.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raku/roast/3549a55760b21222198223238b5fd84a3a708681/S32-io/utf16-test/sample-UTF-16.txt -------------------------------------------------------------------------------- /S32-io/utf16-test/sample-UTF-16BE-bom.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raku/roast/3549a55760b21222198223238b5fd84a3a708681/S32-io/utf16-test/sample-UTF-16BE-bom.txt -------------------------------------------------------------------------------- /S32-io/utf16-test/sample-UTF-16BE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raku/roast/3549a55760b21222198223238b5fd84a3a708681/S32-io/utf16-test/sample-UTF-16BE.txt -------------------------------------------------------------------------------- /S32-io/utf16-test/sample-UTF-16LE-bom.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raku/roast/3549a55760b21222198223238b5fd84a3a708681/S32-io/utf16-test/sample-UTF-16LE-bom.txt -------------------------------------------------------------------------------- /S32-io/utf16-test/sample-UTF-16LE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raku/roast/3549a55760b21222198223238b5fd84a3a708681/S32-io/utf16-test/sample-UTF-16LE.txt -------------------------------------------------------------------------------- /S32-io/utf16-test/sample-UTF-8.txt: -------------------------------------------------------------------------------- 1 | AŁᅁ𑅁🦋 -------------------------------------------------------------------------------- /S32-list/batch.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | use lib $?FILE.IO.parent(2).add: 'packages/Test-Helpers'; 3 | use Test::Util; 4 | 5 | plan 4; 6 | 7 | is-eqv ^10 .batch(3), ((0, 1, 2), (3, 4, 5), (6, 7, 8), (9,)).Seq, '.batch(3)'; 8 | is-eqv ^10 .batch(20), ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9,),).Seq, '.batch(20)'; 9 | is-eqv ^10 .batch(1), 10 | ((0,), (1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,)).Seq, '.batch(1)'; 11 | 12 | throws-like { ^10 .batch(0) }, X::OutOfRange, got => 0, 13 | 'does 0 as batch-size throw'; 14 | 15 | # vim: expandtab shiftwidth=4 16 | -------------------------------------------------------------------------------- /S32-list/cross.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 3; 4 | 5 | # most of the tests for this are done in the S03-metaops/cross.t 6 | # will just test the interface here; 7 | 8 | is-deeply cross(, <1 2>), (, , , ), "plain cross"; 9 | is-deeply cross(, <1 2>, with => &[~]), , "cross with operator"; 10 | 11 | # https://github.com/Raku/old-issue-tracker/issues/4698 12 | eval-lives-ok 'multi sub cross() { }', "multi sub cross shouldn't SEGV"; 13 | 14 | # vim: expandtab shiftwidth=4 15 | -------------------------------------------------------------------------------- /S32-list/map_function_return_values.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 2; 3 | 4 | # L 5 | 6 | my $text = "abc"; 7 | my %ret; 8 | 9 | # XXX depends on the Pair stringification which is likely going to change 10 | 11 | { 12 | %ret = map { $_ => uc $_; }, $text.comb; 13 | is ~%ret.sort, "a\tA b\tB c\tC", "=> works in a map block"; 14 | } 15 | 16 | %ret = flat map { $_, uc $_ }, $text.comb; 17 | is ~%ret.sort, "a\tA b\tB c\tC", "map called with function return values works"; 18 | 19 | # vim: expandtab shiftwidth=4 20 | -------------------------------------------------------------------------------- /S32-list/numbers.data: -------------------------------------------------------------------------------- 1 | -1 2 | -80 3 | 5 4 | 28 5 | -------------------------------------------------------------------------------- /S32-str/append.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # String appending with ~ operator 4 | # L 5 | 6 | plan 7; 7 | 8 | # Again, mostly stolen from Perl 9 | 10 | my $a = 'ab' ~ 'c'; 11 | is($a, 'abc', '~ two literals correctly'); 12 | 13 | my $b = 'def'; 14 | 15 | my $c = $a ~ $b; 16 | is($c, 'abcdef', '~ two variables correctly'); 17 | 18 | $c ~= "xyz"; 19 | is($c, 'abcdefxyz', '~= a literal string correctly'); 20 | 21 | my $d = $a; 22 | $d ~= $b; 23 | is($d, 'abcdef', '~= variable correctly'); 24 | 25 | is('' ~ '', '', 'Concatenating two empty strings'); 26 | is($d ~ '', $d, 'Concatenente non-empty and empty string'); 27 | is('' ~ $d, $d, 'Concatenente empty and non-empty string'); 28 | 29 | # vim: expandtab shiftwidth=4 30 | -------------------------------------------------------------------------------- /S32-str/bool.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 12; 3 | 4 | nok ?'', "?'' is false"; 5 | isa-ok ?'', Bool, "?'' is Bool"; 6 | ok ?'hello', "?'hello' is true"; 7 | isa-ok ?'hello', Bool, "?'hello' is Bool"; 8 | ok ?'0', "?'0' is true"; 9 | isa-ok ?'0', Bool, "?'0' is Bool"; 10 | 11 | nok ''.Bool, "''.Bool is false"; 12 | isa-ok ''.Bool, Bool, "''.Bool is Bool"; 13 | ok 'hello'.Bool, "'hello'.Bool is true"; 14 | isa-ok 'hello'.Bool, Bool, "'hello'.Bool is Bool"; 15 | ok '0'.Bool, "'0'.Bool is true"; 16 | isa-ok '0'.Bool, Bool, "'0'.Bool is Bool"; 17 | 18 | # vim: expandtab shiftwidth=4 19 | -------------------------------------------------------------------------------- /S32-str/pos.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # L 4 | 5 | plan 2; 6 | 7 | my $str = 'moose'; 8 | $str ~~ /oo/; 9 | throws-like '$str.pos', X::Method::NotFound, 'Str.pos superseeded by $/.to'; 10 | 11 | is($/.to, 3, '$/.to works'); 12 | 13 | # vim: expandtab shiftwidth=4 14 | -------------------------------------------------------------------------------- /S32-str/tclc.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 6; 4 | 5 | is tclc('aBcD'), 'Abcd', 'tclc sub form on mixed-case latin string'; 6 | is 'aBcD'.tclc, 'Abcd', 'method form'; 7 | # https://github.com/Raku/old-issue-tracker/issues/3352 8 | #?rakudo.jvm todo "" 9 | is 'ßß'.tclc, 'Ssß', 'tclc and German sharp s'; 10 | is tclc('ljenčariti'), 'Ljenčariti', 'lj => Lj (in one character)'; 11 | is 'Ångstrom'.tclc, 'Ångstrom', 'Å remains Å'; 12 | is "\x1044E TEST".tclc, "\x10426 test", 'tclc works on codepoints greater than 0xffff'; 13 | 14 | 15 | # vim: expandtab shiftwidth=4 16 | -------------------------------------------------------------------------------- /S32-str/text-samples/gb18030_sample_in_gb18030.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raku/roast/3549a55760b21222198223238b5fd84a3a708681/S32-str/text-samples/gb18030_sample_in_gb18030.txt -------------------------------------------------------------------------------- /S32-str/text-samples/gb2312_sample_in_gb2312.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raku/roast/3549a55760b21222198223238b5fd84a3a708681/S32-str/text-samples/gb2312_sample_in_gb2312.txt -------------------------------------------------------------------------------- /S32-str/text-samples/shiftjis_sample.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raku/roast/3549a55760b21222198223238b5fd84a3a708681/S32-str/text-samples/shiftjis_sample.txt -------------------------------------------------------------------------------- /S32-str/text-samples/shiftjis_sample_in_utf8.txt: -------------------------------------------------------------------------------- 1 | 2 | 電子商取引(エレクトロニックコマース)、オンライン情報提供、インタラクティブメディア(双方向通信)。インターネットに代表されるコンピューターとネットワークの充実は私たちの生活を大きく変えています。 3 | 4 | のサーバーは、あらゆるインターネットビジネスに対応しています。イーコマース、コンテンツサービス、画像配信、動画配信、ストリーミング等の総合的且、プロフェッショナルユーズな環境をご提供いたします。 5 | 6 | 当社のテクニカルは、常時24時間体制で対応しておりますのでいかなる事態にも迅速に対応致しております。日々のメンテナンスも安心してお任せ頂けます。 同時に専用高速回線もご提供しておりますので、エンドユーザー様には他では体感することのできない、インターネットブラウジングをお約束致します。 7 | -------------------------------------------------------------------------------- /S32-trig/e.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 5; 3 | 4 | =begin description 5 | 6 | Basic tests for trigonometric functions. 7 | 8 | =end description 9 | 10 | # See also: L<"http://en.wikipedia.org/wiki/E_%28mathematical_constant%29"> :) 11 | my $e = e; 12 | 13 | is(e , $e, "e, as a value"); 14 | throws-like 'e()', X::Undeclared, "e(), dies as a sub"; 15 | is(1 + e, $e+1, "1+e, as a value"); 16 | is(e + 1, $e+1, "e+1, as a value"); 17 | is(1 + e +0, $e+1, "1 + e +0, as a value"); 18 | 19 | # vim: expandtab shiftwidth=4 20 | -------------------------------------------------------------------------------- /S32-trig/pi.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 3; 3 | 4 | =begin description 5 | 6 | Tests for pi function. 7 | 8 | =end description 9 | 10 | # See also: L<"http://theory.cs.iitm.ernet.in/~arvindn/pi/"> :) 11 | my $PI = 3.141592653589e0; 12 | 13 | # -- pi 14 | is-approx(pi, $PI, "pi (using constant)"); 15 | is-approx(pi, atan(1)*4, "pi checked by atan(1)*4"); 16 | is-approx(pi + 3, $PI + 3, "'pi + 3' = PI +3"); 17 | 18 | # vim: expandtab shiftwidth=4 19 | -------------------------------------------------------------------------------- /S32-trig/simple.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 12; 4 | 5 | is-approx sin(0), 0, 'sin(0)'; 6 | is-approx sin(3.1415927), 0, 'sin(pi)'; 7 | is-approx sin(6.2831853), 0, 'sin(2 pi)'; 8 | 9 | # random numbers 10 | my $rn1 = 4.8758e0; 11 | my $rn2 = 0.60612e0; 12 | is-approx sin($rn1), -0.9866781036e0, 'sin(random number 1)'; 13 | is-approx sin($rn2), 0.5696829216e0, 'sin(random number 2)'; 14 | 15 | is-approx cos(0), 1, 'cos(0)'; 16 | is-approx cos(3.1415927), -1, 'cos(pi)'; 17 | is-approx cos(6.2831853), 1, 'cos(2 pi)'; 18 | is-approx cos($rn1), 0.1626847248e0, 'cos(random number 1)'; 19 | is-approx cos($rn2), 0.8218645683e0, 'cos(random number 2)'; 20 | 21 | is-approx tan($rn1), -6.0649708e0, 'tan(random number 1)'; 22 | is-approx tan($rn2), 6.9315912e-1, 'tan(random number 2)'; 23 | 24 | # vim: expandtab shiftwidth=4 25 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | # This branch contains tests from previous language version, as well as any 2 | # additional proposals that *might* make it into the next language version. 3 | # 4 | # Some implementations use this file to select which test files to run, e.g.: 5 | # https://github.com/rakudo/rakudo/blob/master/docs/roast-spectest.data-versioning.md 6 | 6.e.PREVIEW 7 | -------------------------------------------------------------------------------- /integration/advent2009-day01.t: -------------------------------------------------------------------------------- 1 | # http://perl6advent.wordpress.com/2009/12/01/day-1-getting-rakudo/ 2 | 3 | use Test; 4 | 5 | plan(2); 6 | 7 | # say "Hello World"; 8 | 9 | is( (10/7).WHAT.gist, '(Rat)', 'WHAT'); 10 | 11 | is(([+] (1..999).grep( { $_ % 3 == 0 || $_ % 5 == 0 } )), 233168, 'Project Euler #1'); 12 | 13 | # vim: expandtab shiftwidth=4 14 | -------------------------------------------------------------------------------- /integration/advent2009-day04.t: -------------------------------------------------------------------------------- 1 | # http://perl6advent.wordpress.com/2009/12/04/day-4-testing/ 2 | 3 | sub fac(Int $n) { 4 | [*] 1..$n 5 | } 6 | 7 | use Test; 8 | plan 6; 9 | 10 | is fac(0), 1, 'fac(0) works'; 11 | is fac(1), 1, 'fac(1) works'; 12 | is fac(2), 2, 'fac(2) works'; 13 | is fac(3), 6, 'fac(3) works'; 14 | is fac(4), 24, 'fac(4) works'; 15 | 16 | throws-like { EVAL q[fac('oh noes i am a string')] }, X::TypeCheck::Argument; 17 | 18 | # vim: expandtab shiftwidth=4 19 | -------------------------------------------------------------------------------- /integration/advent2009-day15.t: -------------------------------------------------------------------------------- 1 | # http://perl6advent.wordpress.com/2009/12/15/day-15-pick-your-game/ 2 | 3 | use Test; 4 | 5 | plan 4; 6 | 7 | my @dice = 1..6; 8 | is @dice.pick(2).elems, 2, 'Picking two elements using pick()'; 9 | is @dice.pick(10).elems, @dice.elems, 'Picking all elements using pick()'; 10 | is @dice.roll(10).elems, 10, 'Picking 10 elements from a list of 6 using roll'; 11 | 12 | class Card 13 | { 14 | has $.rank; 15 | has $.suit; 16 | 17 | multi method Str() 18 | { 19 | return $.rank ~ $.suit; 20 | } 21 | } 22 | 23 | my @deck; 24 | for -> $rank 25 | { 26 | for <♥ ♣ ♦ ♠> -> $suit 27 | { 28 | @deck.push(Card.new(:$rank, :$suit)); 29 | } 30 | } 31 | 32 | { 33 | @deck .= pick(*); 34 | is @deck.elems, 4 * 13, 'Shuffled card deck'; 35 | } 36 | 37 | # vim: expandtab shiftwidth=4 38 | -------------------------------------------------------------------------------- /integration/advent2009-day19.t: -------------------------------------------------------------------------------- 1 | # http://perl6advent.wordpress.com/2009/12/19/day-19-whatever/ 2 | 3 | use Test; 4 | 5 | plan 6; 6 | 7 | my @x = ; 8 | is @x[*-2], 'd', 'Whatever indexing'; 9 | is @x.pick(*).elems, @x.elems, 'pick(*)'; 10 | 11 | { 12 | is (@x.map: * ~ 'A'), ("aA", "bA", "cA", "dA", "eA"), "* ~ 'A' with map"; 13 | 14 | my $x = * * 2; 15 | is $x(4), 8, '* * 2 generates a code block'; 16 | 17 | is (@x.map: *.succ), ["b", "c", "d", "e", "f"], '*.succ with map'; 18 | 19 | my @list = 1, 5, 'a', 10, 6; 20 | is (@list.sort: ~*), [1, 10, 5, 6, "a"], '~* used to sort as list of strings'; 21 | } 22 | 23 | # vim: expandtab shiftwidth=4 24 | -------------------------------------------------------------------------------- /integration/advent2010-day07.t: -------------------------------------------------------------------------------- 1 | # http://perl6advent.wordpress.com/2010/12/07/day-7-lexical-variables/ 2 | 3 | use Test; 4 | 5 | plan 8; 6 | 7 | throws-like {EVAL '{ $var = 42 }'}, X::Undeclared; 8 | lives-ok {EVAL '{ my $var = 42 }'}; 9 | throws-like {EVAL '{ my $var = 42 }; say $var'}, X::Undeclared; 10 | 11 | sub counter($start_value) { 12 | my $count = $start_value; 13 | return { $count++ }; 14 | } 15 | 16 | my $c1 = counter(5); 17 | is $c1(), 5; 18 | is $c1(), 6; 19 | 20 | my $c2 = counter(42); 21 | is $c2(), 42; 22 | is $c1(), 7; 23 | is $c2(), 43; 24 | 25 | # vim: expandtab shiftwidth=4 26 | -------------------------------------------------------------------------------- /integration/advent2010-day19.t: -------------------------------------------------------------------------------- 1 | # http://perl6advent.wordpress.com/2010/12/19/day-19-false-truth/ 2 | use Test; 3 | plan 6; 4 | 5 | { 6 | my $value = 42 but role { method Bool { False } }; 7 | is $value, 42, 'but role {...}'; 8 | is ?$value, False, 'but role {...}'; 9 | } 10 | 11 | { 12 | my $value = 42 but False; 13 | is $value, 42, '42 but False'; 14 | is ?$value, False, '42 but False'; 15 | } 16 | 17 | # https://github.com/Raku/old-issue-tracker/issues/3390 18 | { 19 | my $value = True but False; 20 | is ~$value, 'False', 'True but False'; 21 | is ?$value, False, 'True but False'; 22 | } 23 | 24 | # vim: expandtab shiftwidth=4 25 | -------------------------------------------------------------------------------- /integration/advent2010-day22.t: -------------------------------------------------------------------------------- 1 | # http://perl6advent.wordpress.com/2010/12/22/day-22-the-meta-object-protocol/ 2 | use Test; 3 | plan 3; 4 | 5 | my $rat-atts = join(', ', Rat.^attributes); 6 | ok ($rat-atts ~~ /'$!numerator'/ && $rat-atts ~~ /'$!denominator'/), 'Rat $!numerator $!denominator& attributes' 7 | or diag "Rat attributes: $rat-atts"; 8 | 9 | my $rat-methods = join ', ', Rat.^methods(:local).map({.name}); 10 | ok ($rat-methods ~~ /'Str'/ && $rat-methods ~~ /'round'/), 'Rat Str and round methods' 11 | or diag "Rat methods: $rat-methods"; 12 | 13 | ok Rat.^methods(:local).grep({.name eq 'log'}).[0].signature.raku, 'log signature'; 14 | 15 | # sub log-calls($obj, Role $r) { ... } 16 | # wrapper example omitted - see 17 | # https://github.com/Raku/old-issue-tracker/issues/3396 18 | 19 | # vim: expandtab shiftwidth=4 20 | -------------------------------------------------------------------------------- /integration/advent2011-day03.t: -------------------------------------------------------------------------------- 1 | #! http://perl6advent.wordpress.com/2011/12/03/buffers-and-binary-io/ 2 | 3 | use Test; 4 | plan 2; 5 | 6 | use newline :lf; 7 | 8 | sub capture-out($code) { 9 | my $output; 10 | my $*OUT = class { 11 | method print(*@args) { 12 | $output ~= @args.join; 13 | } 14 | multi method write(Buf $b){$output ~= $b.decode} 15 | } 16 | $code(); 17 | return $output.lines; 18 | } 19 | 20 | my $buf = Buf.new(0x6d, 0xc3, 0xb8, 0xc3, 0xbe, 0x0a); 21 | is capture-out({$*OUT.write($buf)}), ["møþ"], "buffer write"; 22 | my $str = $buf.decode('UTF-8'); 23 | is $str, "møþ\n", "buffer decode"; 24 | 25 | 26 | # vim: expandtab shiftwidth=4 27 | -------------------------------------------------------------------------------- /integration/advent2011-day05.t: -------------------------------------------------------------------------------- 1 | #! http://perl6advent.wordpress.com/2011/12/05/the-flip-flop-operator/ 2 | 3 | use Test; 4 | plan 5; 5 | 6 | is-deeply [gather for 1..20 { .take if $_ == 9 ff $_ == 13; }], [9, 10, 11, 12, 13]; 7 | is-deeply [gather for 1..20 { .take if $_ == 9 ff^ $_ == 13; }], [9, 10, 11, 12]; 8 | is-deeply [gather for 1..20 { .take if $_ == 9 ^ff $_ == 13; }], [10, 11, 12, 13]; 9 | is-deeply [gather for 1..20 { .take if $_ == 9 ^ff^ $_ == 13; }], [10, 11, 12]; 10 | is-deeply [gather for 1..20 { .take if $_ == 15 ff *; }], [15, 16, 17, 18, 19, 20]; 11 | 12 | # vim: expandtab shiftwidth=4 13 | -------------------------------------------------------------------------------- /integration/advent2011-day07.t: -------------------------------------------------------------------------------- 1 | #! http://perl6advent.wordpress.com/2011/12/07/grammarprofiler/ 2 | use Test; 3 | use lib $?FILE.IO.parent(2).add("packages/Advent/lib"); 4 | 5 | use Advent::GrammarProfiler; 6 | plan 3; 7 | 8 | grammar MyGrammar { 9 | rule TOP { +% } 10 | token num { <[ 0..9 \. ]>+ } 11 | token op { < + - * / = > } 12 | } 13 | ok MyGrammar.parse("37 + 10 - 5 = 42"), "parsed"; 14 | 15 | my %t = get-timing(); 16 | 17 | ok %t, "num calls recorded"; 18 | ok %t ) ⊆ set( ), True, 'a b c ⊆ a b c d'; 10 | is set( ) ⊆ set( ), False, 'a b c d ⊆ a b c'; 11 | is , False, 'a b c ⊆ a b d'; 12 | is === , False, 'a b c === a b c'; 13 | is eqv , True, 'a b c eqv a b c'; 14 | is set().WHICH, set().WHICH, 'make sure .WHICH is consistent'; 15 | 16 | # vim: expandtab shiftwidth=4 17 | -------------------------------------------------------------------------------- /integration/advent2013-day22.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | plan 9; 3 | 4 | sub postfix:($N) { 5 | [*] 2..$N; 6 | } 7 | is 6!, 720, 'factorial'; 8 | 9 | my $x = 2; 10 | my $y = 3; 11 | my $z = 4; 12 | 13 | is $x + $y * $z, $x + ($y * $z), 'precedence'; 14 | is $x * $y + $z, ($x * $y) + $z, 'precedence'; 15 | is $x / $y / $z, ($x / $y) / $z, 'associativity'; 16 | $x = $y = $z; 17 | is $x, $z, 'associativity'; 18 | 19 | # !prefix examples 20 | ok 'a' !eq 'b', '!eq'; 21 | ok 'a' !~~ /b/, '!~~'; 22 | ok 3 !< 2, '!<'; 23 | ok 'b' !before 'a', '!before'; 24 | 25 | 26 | # vim: expandtab shiftwidth=4 27 | -------------------------------------------------------------------------------- /integration/code-blocks-as-sub-args.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | =begin desc 6 | 7 | Test a bug where sub args of type Sub do not get handled correctly. 8 | 9 | =end desc 10 | 11 | sub foo (Sub $code, Str $a, Str $b) { return $a.WHAT } #OK not used 12 | 13 | throws-like {foo(-> { die "test" }, "a", "b")}, 14 | X::TypeCheck::Binding, 15 | 'pointy block is not a sub'; 16 | lives-ok {foo( sub { die "test" }, 'a', 'b')}, 'anonymous sub as argument not executed'; 17 | 18 | sub foo2 (Sub $code, Str $a, Str $b?) { return $a.WHAT } #OK not used 19 | 20 | throws-like {foo2(-> { die "test" }, "a", "b")}, 21 | X::TypeCheck::Binding, 22 | 'pointy block is not a sub (with optional last arg)'; 23 | lives-ok {foo2( sub { die "test" }, 'a', 'b')}, 'anonymous sub as argument not executed (with optional last arg)'; 24 | 25 | # vim: expandtab shiftwidth=4 26 | -------------------------------------------------------------------------------- /integration/deep-recursion-initing-native-array.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | # https://github.com/Raku/old-issue-tracker/issues/5873 6 | # This test is in a file of its own, because the bug it covered was quite 7 | # sensitive to small changes. 8 | 9 | my $size = 10001; 10 | my int @mat[$size; $size]; 11 | init-array(0, $size - 1, $size * $size); 12 | pass 'No SEGV or other crash in recursive init routine on a native array'; 13 | 14 | sub init-array($r, $c, $val) { 15 | @mat[$r; $c] = $val; 16 | if $c - 1 >= 0 17 | { # left 18 | init-array($r, $c - 1, $val - 1); 19 | } 20 | elsif $r + 1 < $size 21 | { # down 22 | init-array($r + 1, $c, $val - 1); 23 | } 24 | } 25 | 26 | # vim: expandtab shiftwidth=4 27 | -------------------------------------------------------------------------------- /integration/diamond.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 2; 4 | 5 | my $dir = $?FILE.IO.sibling("diamond"); 6 | my $script = $dir.child("a.raku"); 7 | my $module = $dir.child("D.rakumod"); 8 | 9 | $module.spurt: q:to/MODULE/; 10 | unit class D; 11 | method foo { print "foo" } 12 | MODULE 13 | 14 | is run($*EXECUTABLE, $script,:out).out.slurp, "foo", 15 | "did the module get precompiled ok and return 'foo'"; 16 | 17 | $module.spurt: q:to/MODULE/; 18 | unit class D; 19 | method foo { print "bar" } 20 | MODULE 21 | 22 | is run($*EXECUTABLE, $script,:out).out.slurp, "bar", 23 | "did the module get precompiled ok and return 'bar'"; 24 | 25 | # vim: expandtab shiftwidth=4 26 | -------------------------------------------------------------------------------- /integration/diamond/A.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | unit class A; 3 | use B; 4 | use C; 5 | also is B; 6 | also is C 7 | -------------------------------------------------------------------------------- /integration/diamond/B.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | unit class B; 3 | use D; 4 | also is D; 5 | -------------------------------------------------------------------------------- /integration/diamond/C.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | unit class C; 3 | use D; 4 | also is D; 5 | -------------------------------------------------------------------------------- /integration/diamond/D.rakumod: -------------------------------------------------------------------------------- 1 | unit class D; 2 | method foo { print "bar" } 3 | -------------------------------------------------------------------------------- /integration/diamond/a.raku: -------------------------------------------------------------------------------- 1 | use v6; 2 | use lib $?FILE.IO.parent; 3 | use A; 4 | A.new.foo; 5 | -------------------------------------------------------------------------------- /integration/eval-and-threads.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | # https://github.com/Raku/old-issue-tracker/issues/6131 6 | lives-ok { 7 | await Promise.allof((^3).map: { 8 | start { 9 | for ^200 { 10 | EVAL "True"; 11 | } 12 | } 13 | }); 14 | }, 'Simple EVAL in a loop does not crash'; 15 | 16 | # vim: expandtab shiftwidth=4 17 | -------------------------------------------------------------------------------- /integration/lazy-bentley-generator.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | sub bentley_clever($seed) { 6 | constant $mod = 1_000_000_000; 7 | 8 | my @state; 9 | 10 | my @seed = ($seed % $mod, 1, (* - *) % $mod ... *)[^55]; 11 | @state = @seed[ 34, (* + 34 ) % 55 ... 0 ]; 12 | 13 | subrand() for 55 .. 219; 14 | 15 | sub subrand() { 16 | push @state, (my $x = (@state.shift - @state[*-24]) % $mod); 17 | $x; 18 | } 19 | 20 | &subrand ... *; 21 | } 22 | 23 | my @sr = bentley_clever(292929); 24 | is @sr[^6].join('|'), 25 | '467478574|512932792|539453717|20349702|615542081|378707948', 26 | 'can do funny things with lazy series'; 27 | 28 | # vim: expandtab shiftwidth=4 29 | -------------------------------------------------------------------------------- /integration/lexical-array-in-inner-block.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 2; 4 | 5 | sub f($n) 6 | { 7 | my $a = [$n]; 8 | 9 | { 10 | is($a[0], $n, "Testing for a lexical variable inside a block.") 11 | } 12 | } 13 | 14 | my $n; 15 | for 2..3 -> $n { 16 | # TEST*2 17 | f($n); 18 | } 19 | 20 | 21 | 22 | 23 | # vim: expandtab shiftwidth=4 24 | -------------------------------------------------------------------------------- /integration/no-indirect-new.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 2; 4 | 5 | # Parsing test, so should use EVAL to ensure it can run even if something is 6 | # broken. 7 | 8 | { 9 | class A { has $.b } 10 | 11 | throws-like { EVAL "new A" }, 12 | X::Obsolete, 13 | 'parameterless prefixed new is allowed'; 14 | 15 | throws-like { EVAL "new A( :b('bulbous bouffant') )" }, 16 | X::Obsolete, 17 | 'what looks like a constructor call is really a coersion to A, and should therefore be disallowed'; 18 | } 19 | 20 | # vim: expandtab shiftwidth=4 21 | -------------------------------------------------------------------------------- /integration/packages.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # test odd things we've seen with modules, packages and namespaces 4 | 5 | 6 | # the module declaration is executed at compile time, 7 | # so we need to plan early 8 | BEGIN { plan 3 }; 9 | 10 | module A { 11 | if 1 { 12 | ok 1, '"if" inside a module works'; 13 | } else { 14 | ok 0, '"if" inside a module works'; 15 | } 16 | 17 | my $x = 0; 18 | for { 19 | $x++; 20 | } 21 | is $x, 3, 'for loop inside a module works'; 22 | 23 | sub b { 42 }; 24 | is EVAL('b'), 42, 25 | 'EVAL inside a module looks up subs in the right namespace'; 26 | } 27 | 28 | # vim: expandtab shiftwidth=4 29 | -------------------------------------------------------------------------------- /integration/pair-in-array.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 3; 4 | 5 | # A list of pairs seems to be a list of pairs but a list of a 6 | # single pair seems to be a a list of the pair's .key, .value 7 | 8 | my @p1 = (1=>'a'); 9 | my @p2 = 1=>'a', 1=>'b'; 10 | my @p3 = 1=>'a', 42; 11 | 12 | sub catWhat (*@a) { [~] map -> $v { WHAT($v).gist }, @a; } 13 | 14 | is catWhat(@p1), '(Pair)', 'array of single Pair holds a Pair'; 15 | is catWhat(@p2), '(Pair)(Pair)', 'array of Pairs holds Pairs'; 16 | is catWhat(@p3), '(Pair)(Int)', 'array of Pair and others holds a Pair'; 17 | 18 | # vim: expandtab shiftwidth=4 19 | -------------------------------------------------------------------------------- /integration/passing-pair-class-to-sub.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # L 4 | # There ought to be a better reference for this. 5 | # And this test is also a candidate to be moved with other subroutine tests. 6 | 7 | 8 | plan 2; 9 | 10 | { 11 | my sub foo ($x) { $x.raku } 12 | 13 | my $pair = (a => 1); 14 | my $Pair = $pair.WHAT; 15 | 16 | lives-ok { foo($Pair) }, "passing ::Pair to a sub works"; 17 | } 18 | 19 | { 20 | my sub foo ($x) { $x.raku } 21 | 22 | my $int = 42; 23 | my $Int = $int.WHAT; 24 | 25 | lives-ok { foo($Int) }, "passing ::Int to a sub works"; 26 | } 27 | 28 | # vim: expandtab shiftwidth=4 29 | -------------------------------------------------------------------------------- /integration/say-crash.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 4; 4 | 5 | # Insure we can process a big string 6 | 7 | my $filename = "tmpfile.txt"; 8 | my $fh = open $filename, :w; 9 | 10 | ok $fh, "temp file created successfully"; 11 | 12 | lives-ok { 13 | $fh.say: "a" x (2**19); 14 | }, "2**19 char string prints"; 15 | 16 | lives-ok { 17 | $fh.say: "a" x (2**20); 18 | }, "2**20 char string prints"; 19 | 20 | $fh.close; 21 | 22 | ok unlink($filename), "temp file unlinked successfully"; 23 | 24 | # vim: expandtab shiftwidth=4 25 | -------------------------------------------------------------------------------- /integration/sequence.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | my $dir = $?FILE.IO.sibling("sequence"); 6 | my $script = $dir.child("foo.raku"); 7 | my $module = $dir.child("Foo.rakumod"); 8 | 9 | #?rakudo.jvm todo "got ''" 10 | is run($*EXECUTABLE, $script, :out).out.slurp(:close), "⎽ ⎼ ⎻ ⎺", 11 | "did the module get precompiled ok and return '⎽ ⎼ ⎻ ⎺'"; 12 | 13 | # vim: expandtab shiftwidth=4 14 | -------------------------------------------------------------------------------- /integration/sequence/Foo.rakumod: -------------------------------------------------------------------------------- 1 | constant @lines is export = '⎽'...'⎺'; 2 | -------------------------------------------------------------------------------- /integration/sequence/foo.raku: -------------------------------------------------------------------------------- 1 | use lib $?FILE.IO.parent; 2 | use Foo; 3 | print @lines; 4 | -------------------------------------------------------------------------------- /integration/substr-after-match-in-gather-in-for.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | plan 1; 4 | 5 | lives-ok( { 6 | for "par 1", "par 2" -> $p { 7 | gather { 8 | my $c = $p; # make an rw copy 9 | while $c ~~ /\s/ { 10 | $c .= substr($/.from); # remove everything before the ws 11 | while $c ~~ /^\s/ { # ...and all ws in beginning of str 12 | $c .= substr(1); 13 | } 14 | } 15 | } 16 | } 17 | }, 'lexicals are bound the way they should, instead of horribly wrong'); 18 | 19 | 20 | # vim: expandtab shiftwidth=4 21 | -------------------------------------------------------------------------------- /integration/topic_in_double_loop.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # Test may seem weird, but Rakudo JVM fails it catastrophically at the moment. 4 | 5 | plan 5; 6 | 7 | for (1, 5) { 8 | for (2, 4) -> $k { 9 | ok $_ !%% 2, '$_ has a sensible value here'; 10 | } 11 | } 12 | 13 | ok True, "Got here!"; 14 | 15 | # vim: expandtab shiftwidth=4 16 | -------------------------------------------------------------------------------- /integration/variables-in-do.t: -------------------------------------------------------------------------------- 1 | use Test; 2 | 3 | # Test may seem weird, but Rakudo JVM fails it catastrophically at the moment. 4 | 5 | plan 3; 6 | 7 | my $i = 42; 8 | do for -> $j { 9 | is $i, 42, '$i has proper value in loop'; 10 | } 11 | 12 | is $i, 42, '$i still has proper value'; 13 | 14 | # vim: expandtab shiftwidth=4 15 | -------------------------------------------------------------------------------- /packages/AandB/lib/A.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | use B; 4 | class A { 5 | has B $.x; 6 | } 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /packages/AandB/lib/A/A.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | # used in S11-modules/nested.t 3 | 4 | module A::A { 5 | use A::B; 6 | } 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /packages/AandB/lib/A/B.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | # used in S11-modules/nested.t 3 | 4 | unit module A::B; 5 | role B { }; 6 | class D does A::B::B { }; 7 | 8 | 9 | 10 | 11 | # vim: expandtab shiftwidth=4 12 | -------------------------------------------------------------------------------- /packages/AandB/lib/B.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | use B::Grammar; 4 | 5 | class B { 6 | method foo { 'method foo' } 7 | } 8 | 9 | 10 | 11 | # vim: expandtab shiftwidth=4 12 | -------------------------------------------------------------------------------- /packages/AandB/lib/B/Grammar.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | grammar B::Grammar { 3 | token TOP { 'B' }; 4 | } 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/AandB/lib/RoleA.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use RoleB; 3 | 4 | unit role RoleA; 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/AandB/lib/RoleB.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | unit role RoleB; 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/Advent/lib/Advent/SingleInheritance.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | my class SingleInheritanceClassHOW 3 | is Metamodel::ClassHOW 4 | { 5 | method add_parent(Mu $obj, Mu $parent) { 6 | if +self.parents($obj, :local) > 0 { 7 | die "Multiple inheritance is forbidden!"; 8 | } 9 | callsame; 10 | } 11 | } 12 | my module EXPORTHOW { } 13 | EXPORTHOW.WHO. = SingleInheritanceClassHOW; 14 | 15 | # vim: expandtab shiftwidth=4 16 | -------------------------------------------------------------------------------- /packages/ArrayInit/lib/ArrayInit.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | unit module ArrayInit; 3 | 4 | # used by S10-packages/basic.t 5 | 6 | sub array_init() is export { 7 | my @array; 8 | push @array, 'just one element'; 9 | return ~@array; 10 | } 11 | 12 | # vim: expandtab shiftwidth=4 13 | -------------------------------------------------------------------------------- /packages/ContainsUnicode/lib/ContainsUnicode.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | module ContainsUnicode { 3 | sub uc-and-join(*@things, :$separator = ', ') is export { 4 | @things».uc.join($separator) 5 | } 6 | } 7 | 8 | # vim: ft=perl6 9 | 10 | 11 | # vim: expandtab shiftwidth=4 12 | -------------------------------------------------------------------------------- /packages/Cool/lib/Cool/Beans.rakumod: -------------------------------------------------------------------------------- 1 | class Cool::Beans { } 2 | 3 | # vim: expandtab shiftwidth=4 4 | -------------------------------------------------------------------------------- /packages/Cool/lib/Cool/Cat.rakumod: -------------------------------------------------------------------------------- 1 | class Cool::Cat { 2 | method meow { 'meow' } 3 | } 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/Cool/lib/Cool/Cat/Goes/Splat.rakumod: -------------------------------------------------------------------------------- 1 | class Cool::Cat::Goes::Splat { 2 | method meow { 'splat' } 3 | } 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/Cool/lib/Cool/Utils.rakumod: -------------------------------------------------------------------------------- 1 | unit module Cool::Utils; 2 | 3 | # vim: expandtab shiftwidth=4 4 | -------------------------------------------------------------------------------- /packages/CurrentDistributionOne/META6.json: -------------------------------------------------------------------------------- 1 | { 2 | "perl" : "6.c", 3 | "name" : "CurrentDistributionOne", 4 | "auth" : "foo@bar.baz", 5 | "description" : "A distribution for basic testing of $?DISTRIBUTION and %?RESOURCES", 6 | "depends" : [ ], 7 | "provides" : { 8 | "CurrentDistributionOne" : "lib/CurrentDistributionOne.rakumod" 9 | }, 10 | "resources" : [ 11 | "foo.txt" 12 | ] 13 | } 14 | 15 | -------------------------------------------------------------------------------- /packages/CurrentDistributionOne/lib/CurrentDistributionOne.rakumod: -------------------------------------------------------------------------------- 1 | unit module CurrentDistributionOne; 2 | 3 | our sub distribution { $?DISTRIBUTION } 4 | 5 | our sub resources { %?RESOURCES } 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /packages/CurrentDistributionOne/resources/foo.txt: -------------------------------------------------------------------------------- 1 | CurrentDistributionOne 2 | -------------------------------------------------------------------------------- /packages/CurrentDistributionTwo/META6.json: -------------------------------------------------------------------------------- 1 | { 2 | "perl" : "6.c", 3 | "name" : "CurrentDistributionTwo", 4 | "description" : "Like CurrentDistributionOne, but also depends on CurrentDistributionOne and its $?DISTRIBUTION", 5 | "depends" : [ "CurrentDistributionOne" ], 6 | "provides" : { 7 | "CurrentDistributionTwo" : "lib/CurrentDistributionTwo.rakumod" 8 | }, 9 | "resources" : [ 10 | "foo.txt" 11 | ] 12 | } 13 | 14 | -------------------------------------------------------------------------------- /packages/CurrentDistributionTwo/lib/CurrentDistributionTwo.rakumod: -------------------------------------------------------------------------------- 1 | unit module CurrentDistributionTwo; 2 | 3 | our sub distribution { $?DISTRIBUTION } 4 | 5 | our sub resources { %?RESOURCES } 6 | 7 | our sub dependency-distribution { 8 | use CurrentDistributionOne:auth; 9 | CurrentDistributionOne::distribution; 10 | } 11 | 12 | our sub dependency-resources { 13 | use CurrentDistributionOne; 14 | CurrentDistributionOne::resources; 15 | } 16 | 17 | # vim: expandtab shiftwidth=4 18 | -------------------------------------------------------------------------------- /packages/CurrentDistributionTwo/resources/foo.txt: -------------------------------------------------------------------------------- 1 | CurrentDistributionTwo 2 | -------------------------------------------------------------------------------- /packages/Example/lib/Example/A.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Example::C; 3 | 4 | package Example::A {} 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/Example/lib/Example/B.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Example::C; 3 | 4 | package Example::B {} 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/Example/lib/Example/C.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | package Example::C { } 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/Example2/lib/Example2/A.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Example2::R; 3 | use Example2::H; 4 | use Example2::B; 5 | use Example2::E; 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /packages/Example2/lib/Example2/B.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | use Example2::P; 4 | use Example2::N; 5 | use Example2::S; 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /packages/Example2/lib/Example2/C.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Example2::K; 3 | 4 | class Example2::C { 5 | } 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /packages/Example2/lib/Example2/D.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | role Example2::D { 3 | } 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/Example2/lib/Example2/E.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Example2::P; 3 | 4 | class Example2::E { 5 | } 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /packages/Example2/lib/Example2/F.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | use Example2::P; 4 | 5 | class Example2::F does Example2::P { 6 | } 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /packages/Example2/lib/Example2/G.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | package Example2 {} 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/Example2/lib/Example2/H.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | use Example2::D; 4 | use Example2::P; 5 | 6 | class Example2::H does Example2::D does Example2::P { 7 | multi method new() { 8 | "" # XXX if you remove this, it works?! 9 | } 10 | } 11 | 12 | # vim: expandtab shiftwidth=4 13 | -------------------------------------------------------------------------------- /packages/Example2/lib/Example2/K.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Example2::G; 3 | 4 | class Example2::K { 5 | } 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /packages/Example2/lib/Example2/N.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | use Example2::D; 4 | use Example2::P; 5 | 6 | class Example2::N does Example2::D does Example2::P { 7 | method perl() { 8 | "" # XXX if you remove this, it works?! 9 | } 10 | } 11 | 12 | # vim: expandtab shiftwidth=4 13 | -------------------------------------------------------------------------------- /packages/Example2/lib/Example2/P.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | role Example2::P { 4 | } 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/Example2/lib/Example2/R.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | use Example2::D; 4 | 5 | class Example2::R does Example2::D { 6 | } 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /packages/Example2/lib/Example2/S.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | use Example2::D; 4 | use Example2::P; 5 | 6 | class Example2::S does Example2::D does Example2::P { 7 | method new() { 8 | "" # removing this fixes the problem 9 | } 10 | } 11 | 12 | # vim: expandtab shiftwidth=4 13 | -------------------------------------------------------------------------------- /packages/Example2/lib/Example2/T.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | module T { 3 | my @vars; 4 | my $indents = ""; 5 | } 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /packages/Example2/lib/Example2/U.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Example2::C; 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/ExportConstant/lib/ExportConstant.rakumod: -------------------------------------------------------------------------------- 1 | constant $constant-regex is export = /fo*/; 2 | constant &constant-sub is export = sub { "win" }; 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/Export_Pack/lib/Export_PackA.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | module Export_PackA { 4 | our sub exported_foo () is export { 5 | 42; 6 | } 7 | } 8 | 9 | # vim: expandtab shiftwidth=4 10 | -------------------------------------------------------------------------------- /packages/Export_Pack/lib/Export_PackB.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | module Export_PackB { 4 | use Export_PackA; 5 | 6 | our sub does_export_work () { 7 | try { exported_foo() } == 42; 8 | } 9 | } 10 | 11 | # vim: expandtab shiftwidth=4 12 | -------------------------------------------------------------------------------- /packages/Export_Pack/lib/Export_PackC.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | module Export_PackC { 4 | sub foo_packc () is export { 5 | 1; 6 | } 7 | } 8 | 9 | # vim: expandtab shiftwidth=4 10 | -------------------------------------------------------------------------------- /packages/Export_Pack/lib/Export_PackD.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | module Export_PackD { 4 | sub this_gets_exported_lexically () is export { 5 | 'moose!' 6 | } 7 | } 8 | 9 | # vim: expandtab shiftwidth=4 10 | -------------------------------------------------------------------------------- /packages/Fancy/lib/Fancy/Utilities.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | module Fancy::Utilities { 3 | our sub lolgreet($who) is export(:lolcat, :greet) { 4 | return "O HAI " ~ uc $who; 5 | } 6 | sub nicegreet($who) is export(:greet, :DEFAULT) { 7 | return "Good morning, $who!"; # Always morning? 8 | } 9 | sub shortgreet is export(:greet) { 10 | return "Hi!"; 11 | } 12 | sub lolrequest($item) is export(:lolcat) { 13 | return "I CAN HAZ A {uc $item}?"; 14 | } 15 | sub allgreet() is export { 16 | 'hi all'; 17 | } 18 | 19 | proto greet is export {*}; 20 | multi sub greet(Str $who) { return "Good morning, $who!" } 21 | multi sub greet() { return "Hi!" } 22 | } 23 | 24 | # vim: expandtab shiftwidth=4 25 | -------------------------------------------------------------------------------- /packages/FooBarBaz/lib/Bar.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | use Foo; 4 | 5 | unit class Bar is ::Foo; 6 | 7 | method bar { "bar" } 8 | 9 | 10 | # vim: expandtab shiftwidth=4 11 | -------------------------------------------------------------------------------- /packages/FooBarBaz/lib/Baz.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | use Foo; 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/FooBarBaz/lib/Foo.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | 4 | unit class Foo; 5 | 6 | method foo { "foo" } 7 | 8 | sub ucfirst($thing) is export(:DEFAULT) { 'overridden ucfirst' } #OK not used 9 | sub dies() is export { die 'Death from class Foo' } 10 | 11 | # vim: expandtab shiftwidth=4 12 | -------------------------------------------------------------------------------- /packages/FooBarBaz/lib/FooBar.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | use Bar; 4 | 5 | unit class FooBar is ::Bar; 6 | 7 | method foobar { "foobar" } 8 | 9 | # vim: expandtab shiftwidth=4 10 | -------------------------------------------------------------------------------- /packages/HasMain/lib/HasMain.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | module HasMain { 3 | sub MAIN() { die 'HasMain::Main' } 4 | } 5 | sub MAIN() { die 'MAIN' } 6 | 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /packages/InternArray/lib/InternArrayA.rakumod: -------------------------------------------------------------------------------- 1 | my constant VALUE = array[uint32].new; 2 | sub a() is export { VALUE } 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/InternArray/lib/InternArrayB.rakumod: -------------------------------------------------------------------------------- 1 | my constant VALUE = array[uint32].new; 2 | sub b() is export { VALUE } 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/LoadCounter/lib/LoadCounter.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | unit module LoadCounter; 4 | 5 | $Main::loaded++; 6 | 7 | sub import { 8 | $Main::imported++; 9 | } 10 | 11 | sub unimport { 12 | $Main::imported--; 13 | } 14 | 15 | # vim: expandtab shiftwidth=4 16 | -------------------------------------------------------------------------------- /packages/LoadFromInside/lib/LoadFromInsideAClass.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | class LoadFromInsideAClass { 3 | use LoadMe; 4 | } 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/LoadFromInside/lib/LoadFromInsideAModule.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | module LoadFromInsideAModule { 3 | use LoadMe; 4 | } 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/LoadFromInside/lib/LoadMe.rakumod: -------------------------------------------------------------------------------- 1 | unit module LoadMe; 2 | 3 | # vim: expandtab shiftwidth=4 4 | -------------------------------------------------------------------------------- /packages/OverrideTest/lib/OverrideTest.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | module OverrideTest { 3 | sub test_tc($y) is export(:DEFAULT) { 4 | tc($y); 5 | } 6 | } 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /packages/PM6/lib/PM6.rakumod: -------------------------------------------------------------------------------- 1 | module PM6 { 2 | sub pm6_works() is export { 42 } 3 | 4 | } 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/PackageTest/lib/PackageTest.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | package PackageTest { 4 | 5 | our sub ns { "PackageTest" } 6 | 7 | our sub pkg { $?PACKAGE } 8 | 9 | sub test_export is export { "party island" } 10 | 11 | our package Our::Package { 12 | 13 | our sub pkg { $?PACKAGE } 14 | 15 | } 16 | 17 | 18 | our sub get_our_pkg { 19 | Our::Package::pkg(); 20 | } 21 | 22 | sub cant_see_pkg { 23 | return My::Package::pkg(); 24 | } 25 | 26 | { 27 | my package My::Package { 28 | our sub pkg { $?PACKAGE } 29 | } 30 | 31 | our sub my_pkg { 32 | return My::Package::pkg(); 33 | } 34 | } 35 | 36 | sub dummy_sub_with_params($arg1, $arg2) is export { "[$arg1] [$arg2]" } 37 | } 38 | 39 | # vim: expandtab shiftwidth=4 40 | -------------------------------------------------------------------------------- /packages/R3783/lib/Shadow.pm: -------------------------------------------------------------------------------- 1 | package Shadow; 2 | our $debug = 1; 3 | 1; -------------------------------------------------------------------------------- /packages/R3783/lib/Shadow.rakumod: -------------------------------------------------------------------------------- 1 | unit module Shadow; 2 | our $debug = 1; -------------------------------------------------------------------------------- /packages/README: -------------------------------------------------------------------------------- 1 | ***************************************************************************** 2 | ** WARNING: This file can be used by some tests as an arbitrary file to read 3 | ** arbitrary data from and rely on it being located here, under this name. 4 | ** If changing the name or location, ensure all tests still pass. 5 | ***************************************************************************** 6 | -------------------------------------------------------------------------------- /packages/RT112626/lib/RT112626/Class1.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use RT112626::Role; 3 | class RT112626::Class1 does RT112626::Role { } 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/RT112626/lib/RT112626/Class2.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use RT112626::Role; 3 | class RT112626::Class2 does RT112626::Role { } 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/RT112626/lib/RT112626/Conflict.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use RT112626::Class1; 3 | use RT112626::Class2; 4 | 5 | sub f(RT112626::Class1 $x) {} 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /packages/RT112626/lib/RT112626/Role.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | role RT112626::Role { } 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT115240/lib/RT115240.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | role Foo [ ] { }; 3 | role Bar does Foo[] { } 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/RT117117/lib/RT117117/Backend/AST.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use RT117117::Grammar; 3 | unit class RT117117::Backend::AST; 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/RT117117/lib/RT117117/Backend/GNUC.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use RT117117::Grammar; 3 | unit class RT117117::Backend::GNUC; 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/RT117117/lib/RT117117/Backends.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use RT117117::Backend::AST; 3 | use RT117117::Backend::GNUC; 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/RT117117/lib/RT117117/Grammar.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | unit class RT117117::Grammar; 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT122447/lib/RT122447.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | sub foo($bar) { 3 | Proxy.new( FETCH => sub (|) { }, STORE => sub (|) { } ); 4 | } 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/RT123276/lib/RT123276.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | class RT123276 {} 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT123276/lib/RT123276/B/C1.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | class RT123276::B::C1 { 3 | use RT123276; 4 | method foo(){} 5 | } 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /packages/RT123276/lib/RT123276/B/C2.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | class RT123276::B::C2 { 3 | use RT123276; 4 | method bar(){} 5 | } 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /packages/RT124162/lib/RT124162.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | my @f = $(array[uint32].new(0,1)), $(array[uint32].new(3,4)); 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT125090/lib/RT125090.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | BEGIN $*KERNEL; 3 | BEGIN $*DISTRO; 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/RT125245/lib/RT125245.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | subset File of Str; my File $in = $?FILE; 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT125715/lib/RT125715.rakumod: -------------------------------------------------------------------------------- 1 | class Foo {} 2 | sub EXPORT(|){ { 'Bar' => Foo } } 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT126302/lib/RT126302.rakumod: -------------------------------------------------------------------------------- 1 | no precompilation; 2 | class RT126302 { use RT126302::B; } 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT126302/lib/RT126302/B.rakumod: -------------------------------------------------------------------------------- 1 | no precompilation; 2 | class RT126302::B { has $!foo is rw; } 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT126878/lib/RT126878/NoPrecomp.rakumod: -------------------------------------------------------------------------------- 1 | no precompilation; 2 | 3 | # vim: expandtab shiftwidth=4 4 | -------------------------------------------------------------------------------- /packages/RT126878/lib/RT126878/Precomp.rakumod: -------------------------------------------------------------------------------- 1 | need RT126878::NoPrecomp; 2 | 3 | # vim: expandtab shiftwidth=4 4 | -------------------------------------------------------------------------------- /packages/RT126904/lib/Woohoo/Foo/Bar.rakumod: -------------------------------------------------------------------------------- 1 | use Woohoo::Qux; 2 | class Woohoo::Foo::Bar { 3 | } 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/RT126904/lib/Woohoo/Foo/Baz.rakumod: -------------------------------------------------------------------------------- 1 | use Woohoo::Qux; 2 | class Woohoo::Foo::Baz { 3 | } 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/RT126904/lib/Woohoo/Qux.rakumod: -------------------------------------------------------------------------------- 1 | class Woohoo::Qux { 2 | } 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT127176/lib/RT127176.rakumod: -------------------------------------------------------------------------------- 1 | class RT127176 { blarg! }; 2 | 3 | # vim: expandtab shiftwidth=4 4 | -------------------------------------------------------------------------------- /packages/RT128156/lib/A.rakumod: -------------------------------------------------------------------------------- 1 | use C; use B; 2 | 3 | # vim: expandtab shiftwidth=4 4 | -------------------------------------------------------------------------------- /packages/RT128156/lib/B.rakumod: -------------------------------------------------------------------------------- 1 | use C; 2 | 3 | # vim: expandtab shiftwidth=4 4 | -------------------------------------------------------------------------------- /packages/RT128156/lib/C.rakumod: -------------------------------------------------------------------------------- 1 | use D; 2 | 3 | # vim: expandtab shiftwidth=4 4 | -------------------------------------------------------------------------------- /packages/RT128156/lib/D.rakumod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raku/roast/3549a55760b21222198223238b5fd84a3a708681/packages/RT128156/lib/D.rakumod -------------------------------------------------------------------------------- /packages/RT128156/lib/RT128156/C.rakumod: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Raku/roast/3549a55760b21222198223238b5fd84a3a708681/packages/RT128156/lib/RT128156/C.rakumod -------------------------------------------------------------------------------- /packages/RT128156/lib/RT128156/Needed.rakumod: -------------------------------------------------------------------------------- 1 | class Needed { method version() { 2 } } -------------------------------------------------------------------------------- /packages/RT128156/lib/RT128156/One.rakumod: -------------------------------------------------------------------------------- 1 | class RT128156::One {}; 2 | need RT128156::Two; 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT128156/lib/RT128156/Three.rakumod: -------------------------------------------------------------------------------- 1 | # Empty 2 | class RT128156::Three {}; 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT128156/lib/RT128156/Top1.rakumod: -------------------------------------------------------------------------------- 1 | need RT128156::Needed; 2 | class Top1 { method version-of-needed() { Needed.version } }; 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT128156/lib/RT128156/Top2.rakumod: -------------------------------------------------------------------------------- 1 | need RT128156::Needed; 2 | class Top2 {}; 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT128156/lib/RT128156/Two.rakumod: -------------------------------------------------------------------------------- 1 | need RT128156::Three; 2 | 3 | class RT128156::Two {}; 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/RT129215/lib/RT129215.rakumod: -------------------------------------------------------------------------------- 1 | unit module RT129215; 2 | 3 | sub array_str ($data) is export { $data ~~ Array[Str]; }; 4 | sub hash_str ($data) is export { $data ~~ Hash[Str]; }; 5 | sub hash_hash_str ($data) is export { $data ~~ Hash[Hash[Str]]; }; 6 | 7 | sub str_d ($data) is export { $data ~~ Str:D; }; 8 | sub array_str_d ($data) is export { $data ~~ Array[Str:D]; }; 9 | sub hash_str_d ($data) is export { $data ~~ Hash[Str:D]; }; 10 | sub hash_hash_str_d ($data) is export { $data ~~ Hash[Hash[Str:D]]; }; 11 | 12 | sub str_u ($data) is export { $data ~~ Str:U; }; 13 | sub array_str_u ($data) is export { $data ~~ Array[Str:U]; }; 14 | sub hash_str_u ($data) is export { $data ~~ Hash[Str:U]; }; 15 | sub hash_hash_str_u ($data) is export { $data ~~ Hash[Hash[Str:U]]; }; 16 | 17 | # vim: expandtab shiftwidth=4 18 | -------------------------------------------------------------------------------- /packages/RT129266/lib/RT129266/Bar.rakumod: -------------------------------------------------------------------------------- 1 | use RT129266::Foo; 2 | sub var is export { $bar } 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT129266/lib/RT129266/Foo.rakumod: -------------------------------------------------------------------------------- 1 | constant $bar is export = "«VALUE»"; 2 | 3 | # vim: expandtab shiftwidth=4 4 | -------------------------------------------------------------------------------- /packages/RT76456/lib/RT76456.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | role A[::T] { } 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT76606/lib/RT76606.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use RT76606::a; 3 | 4 | class RT76606 { } 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/RT76606/lib/RT76606/a.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | class RT76606::a { }; 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/RT83354/lib/RT83354_A.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | class RT83354_A { 3 | has $.a; 4 | 5 | multi sub infix:<+>(RT83354_A $x, RT83354_A $y) is export { 6 | RT83354_A.new(:a($x.a + $y.a)); 7 | } 8 | } 9 | 10 | # vim: expandtab shiftwidth=4 11 | -------------------------------------------------------------------------------- /packages/RT83354/lib/RT83354_B.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use RT83354_A; 3 | 4 | class RT83354_B { 5 | has $.b; 6 | 7 | multi sub infix:<+>(RT83354_B $x, RT83354_B $y) is export { 8 | RT83354_B.new(:b($x.b + $y.b)); 9 | } 10 | } 11 | 12 | # vim: expandtab shiftwidth=4 13 | -------------------------------------------------------------------------------- /packages/RT84280/lib/RT84280.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | unit module RT84280; 3 | 4 | sub foo(Str $a) is export { 5 | } 6 | 7 | multi sub bar(Str $a) is export { 8 | } 9 | 10 | # vim: expandtab shiftwidth=4 11 | -------------------------------------------------------------------------------- /packages/RequireAndUse/lib/RequireAndUse1.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | # require and use return the last statement evaluated in the .pm, in this case 4 | # 42. See thread "What do use and require evaluate to?" on p6l started by Ingo 5 | # Blechschmidt, L<"http://www.nntp.perl.org/group/perl.perl6.language/22258">. 6 | 7 | module RequireAndUse1 { 8 | 23; 9 | } 10 | 11 | 42; 12 | 13 | # vim: expandtab shiftwidth=4 14 | -------------------------------------------------------------------------------- /packages/RequireAndUse/lib/RequireAndUse2.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | # module Foo {...} returns the Foo module object, 4 | # see thread "What do use and require evaluate to?" on p6l started by Ingo 5 | # Blechschmidt, L<"http://www.nntp.perl.org/group/perl.perl6.language/22258">. 6 | 7 | module RequireAndUse2 { 8 | 23; 9 | } 10 | 11 | # vim: expandtab shiftwidth=4 12 | -------------------------------------------------------------------------------- /packages/RequireAndUse/lib/RequireAndUse3.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | 3 | # "module Foo; ..." is equivalent to "module Foo {...}", so it returns the Foo 4 | # module object, see thread "What do use and require evaluate to?" on p6l 5 | # started by Ingo Blechschmidt, 6 | # L<"http://www.nntp.perl.org/group/perl.perl6.language/22258">. 7 | 8 | unit module RequireAndUse3; 9 | 10 | 23; 11 | 12 | # vim: expandtab shiftwidth=4 13 | -------------------------------------------------------------------------------- /packages/Roles/lib/GH2613.rakumod: -------------------------------------------------------------------------------- 1 | unit module GH2613; 2 | 3 | role R1 is export { 4 | } 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/S02-names/lib/GH3104_6d.rakumod: -------------------------------------------------------------------------------- 1 | use v6.d; 2 | unit module GH3104_6d; 3 | 4 | sub callback-simple(&code) is export { 5 | code 6 | } 7 | 8 | sub callback-in-map(&code) is export { 9 | .map: { code } 10 | } 11 | 12 | sub callback-in-callback(&code) is export { 13 | callback-simple(&code) 14 | } 15 | 16 | sub client-revision is export { 17 | CLIENT::LEXICAL:: 18 | } 19 | 20 | sub client-package is export { 21 | CLIENT::LEXICAL::<$?PACKAGE> 22 | } 23 | 24 | # vim: expandtab shiftwidth=4 25 | -------------------------------------------------------------------------------- /packages/S02-names/lib/Pseudo6c.rakumod: -------------------------------------------------------------------------------- 1 | use v6.c; 2 | 3 | # Will return a PseudoStash from 6.c 4 | sub pseudo-stash is export { 5 | MY:: 6 | } 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /packages/S02-names/lib/Pseudo6d.rakumod: -------------------------------------------------------------------------------- 1 | use v6.d; 2 | 3 | # Will return a PseudoStash from 6.c because 6.d doesn't define it 4 | sub pseudo-stash is export { 5 | MY:: 6 | } 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /packages/S02-names/lib/Pseudo6e.rakumod: -------------------------------------------------------------------------------- 1 | use v6.e.PREVIEW; 2 | 3 | # Will return a PseudoStash from 6.e 4 | sub pseudo-stash is export { 5 | MY:: 6 | } 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /packages/S02-types/lib/Subset6c.rakumod: -------------------------------------------------------------------------------- 1 | use v6.c; 2 | 3 | subset SSDefined6c is export of Int where { .defined }; 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/S02-types/lib/Subset6e.rakumod: -------------------------------------------------------------------------------- 1 | use v6.e.PREVIEW; 2 | 3 | subset SSDefined6e is export of Int where { .defined }; 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/S06-multi/lib/compile-time.rakumod: -------------------------------------------------------------------------------- 1 | unit module compile-time; 2 | no precompilation; 3 | use Test; 4 | 5 | class C1 { 6 | proto method foo (|) {*} 7 | multi method foo (Mu $c) { 8 | "C1::foo(Mu)" 9 | } 10 | } 11 | 12 | class C2 is C1 { 13 | multi method foo (Any $c) { 14 | "C2::foo(Any)" 15 | } 16 | } 17 | 18 | BEGIN { 19 | # GH 2772: Rakudo was chosing C1::foo(Mu) before the fix 20 | is C2.new.foo(Any), "C2::foo(Any)", "candidate choice for child class"; 21 | is C1.new.foo(Any), "C1::foo(Mu)", "candidate choice for parent class"; 22 | } 23 | 24 | # vim: expandtab shiftwidth=4 25 | -------------------------------------------------------------------------------- /packages/S10-packages/lib/GH2897-A.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | unit module GH2897-A; 3 | 4 | sub gen-counter is export { 5 | my $foo = 0; 6 | sub counter { $foo++ } 7 | } 8 | 9 | # vim: expandtab shiftwidth=4 10 | -------------------------------------------------------------------------------- /packages/S10-packages/lib/GH2897-B.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | unit module GH2897-B; 3 | use GH2897-A; 4 | 5 | our &my-counter is export; 6 | 7 | BEGIN { 8 | &my-counter = gen-counter; 9 | } 10 | 11 | # vim: expandtab shiftwidth=4 12 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/EmptyClass.rakumod: -------------------------------------------------------------------------------- 1 | unit class EmptyClass; 2 | 3 | # vim: expandtab shiftwidth=4 4 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/ExportsEnumDate.rakumod: -------------------------------------------------------------------------------- 1 | enum E::D ; 2 | 3 | # vim: expandtab shiftwidth=4 4 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/Foo.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | # L 3 | 4 | unit module Foo; 5 | sub foo is export(:DEFAULT) { 'Foo::foo' } # :DEFAULT, :ALL 6 | sub bar is export(:DEFAULT, :others) { 'Foo::bar' } # :DEFAULT, :ALL, :others 7 | sub baz is export(:MANDATORY) { 'Foo::baz' } # (always exported) 8 | sub bop is export { 'Foo::bop' } # :DEFAULT, :ALL 9 | sub qux is export(:others) { 'Foo::qux' } # :ALL, :others 10 | multi waz() is export { 'Foo::waz' } # :ALL, :DEFAULT (implicit export) 11 | multi gaz() is export(:others) { 'Foo::gaz1' } # :ALL, :others 12 | multi gaz($x) is export(:others) { 'Foo::gaz2' } # :ALL, :others 13 | 14 | # vim: expandtab shiftwidth=4 15 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/GH2979-Foo.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | unit module GH2979-Foo; 3 | 4 | our @foo is export; 5 | our %foo is export; 6 | our $foo is export; 7 | sub foo is export { } 8 | 9 | # vim: expandtab shiftwidth=4 10 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/GH2979.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | use GH2979-Foo; 3 | 4 | our @b; 5 | our %b; 6 | our $b; 7 | sub b { } 8 | 9 | multi EXPORT { 10 | Map.new( 11 | GH2979-Foo::EXPORT::ALL::, 12 | '@bar' => @b, 13 | '%bar' => %b, 14 | '$bar' => $b, 15 | '&bar' => &b, 16 | ) 17 | } 18 | 19 | # vim: expandtab shiftwidth=4 20 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/GH2983.rakumod: -------------------------------------------------------------------------------- 1 | role R-GH2983 is export { } 2 | class C-GH2983 is export { } 3 | our constant C2983 is export = 42; 4 | our $question is export = "The Ultimate Question of Life, the Universe, and Everything"; 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/GlobalInner.rakumod: -------------------------------------------------------------------------------- 1 | class GlobalInner { 2 | } 3 | 4 | # vim: expandtab shiftwidth=4 5 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/GlobalOuter.rakumod: -------------------------------------------------------------------------------- 1 | class GlobalOuter { 2 | method load() { 3 | require "GlobalInner.rakumod"; 4 | return ::('GlobalInner') !~~ Failure; 5 | } 6 | } 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/InnerClass.rakumod: -------------------------------------------------------------------------------- 1 | class InnerClass { 2 | method test1() { 3 | 'test1'; 4 | } 5 | } 6 | 7 | class InnerClassTwo { 8 | method test2() { 9 | 'test2'; 10 | } 11 | } 12 | 13 | # vim: expandtab shiftwidth=4 14 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/InnerModule.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | unit module InnerModule; 3 | 4 | sub foo is export(:DEFAULT) {'Inner::foo'} 5 | sub bar is export {'Inner::bar'} 6 | sub baz is export(:MANDATORY) {'Inner::baz'} 7 | # sub qux is export(:sometag) {'Inner::qux'} 8 | sub quux is export { 'Inner::quux' } 9 | our sub oursub { 'Inner::oursub' } 10 | 11 | # vim: expandtab shiftwidth=4 12 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/Main.rakumod: -------------------------------------------------------------------------------- 1 | unit class Main; 2 | 3 | # vim: expandtab shiftwidth=4 4 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/Main/Nested.rakumod: -------------------------------------------------------------------------------- 1 | use Main; 2 | use Main; 3 | unit class Main::Nested; 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/MainLoadsNestedFirst.rakumod: -------------------------------------------------------------------------------- 1 | use v6.c; 2 | 3 | use MainLoadsNestedFirst::Nested; 4 | 5 | class MainLoadsNestedFirst::OtherNested { 6 | method foo(MainLoadsNestedFirst::Nested $b) { 7 | } 8 | 9 | method bar(MainLoadsNestedFirst::OtherNested $b) { 10 | } 11 | } 12 | 13 | class MainLoadsNestedFirst { 14 | method foo(MainLoadsNestedFirst::Nested $b) { 15 | } 16 | 17 | method bar(MainLoadsNestedFirst $b) { 18 | } 19 | } 20 | 21 | # vim: expandtab shiftwidth=4 22 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/MainLoadsNestedFirst/Nested.rakumod: -------------------------------------------------------------------------------- 1 | use v6.c; 2 | 3 | unit class MainLoadsNestedFirst::Nested; 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/MainLoadsNestedInside.rakumod: -------------------------------------------------------------------------------- 1 | use v6.c; 2 | 3 | class MainLoadsNestedInside::OtherNested { 4 | use MainLoadsNestedInside::Nested; 5 | 6 | method foo(MainLoadsNestedInside::OtherNested $b) { 7 | } 8 | 9 | method bar(MainLoadsNestedInside::Nested $b) { 10 | } 11 | } 12 | 13 | class MainLoadsNestedInside { 14 | use MainLoadsNestedInside::Nested; 15 | 16 | method foo(MainLoadsNestedInside::Nested $b) { 17 | } 18 | 19 | method bar(MainLoadsNestedInside $b) { 20 | } 21 | } 22 | 23 | # vim: expandtab shiftwidth=4 24 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/MainLoadsNestedInside/Nested.rakumod: -------------------------------------------------------------------------------- 1 | use v6.c; 2 | 3 | unit class MainLoadsNestedInside::Nested; 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/Module_6c.rakumod: -------------------------------------------------------------------------------- 1 | use v6.c; 2 | unit module Module_6c; 3 | 4 | sub core-revision is export { CORE-SETTING-REV } 5 | sub raku-version is export { BEGIN $*RAKU.version } 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/Module_6d.rakumod: -------------------------------------------------------------------------------- 1 | use v6.d; 2 | 3 | unit module Module_6d; 4 | 5 | sub core-revision is export { CORE-SETTING-REV } 6 | sub raku-version is export { BEGIN $*RAKU.version } 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/Module_6e.rakumod: -------------------------------------------------------------------------------- 1 | use v6.e.PREVIEW; 2 | unit module Module_6e; 3 | 4 | sub core-revision is export { CORE-SETTING-REV } 5 | sub raku-version is export { BEGIN $*RAKU.version } 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/NoModule.rakumod: -------------------------------------------------------------------------------- 1 | sub bar is export { 'NoModule::bar' } 2 | 3 | # vim: expandtab shiftwidth=4 4 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/NoPrecompilation.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | unit module NoPrecompilation; 3 | no precompilation; 4 | 5 | sub the-answer is export { 42 } 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/OuterModule.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | unit module OuterModule; 3 | 4 | use InnerModule :ALL, :EXPORT; 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/RuntimeCreatedPackage.rakumod: -------------------------------------------------------------------------------- 1 | ::GLOBAL.WHO := Metamodel::PackageHOW.new_type(name => 'CreatedAtRuntime'); 2 | 3 | # vim: expandtab shiftwidth=4 4 | -------------------------------------------------------------------------------- /packages/S11-modules/lib/SetConst.rakumod: -------------------------------------------------------------------------------- 1 | class SetConst { 2 | constant X = set < x y >; 3 | } 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/S12-meta/lib/Declare.rakumod: -------------------------------------------------------------------------------- 1 | role Controller { 2 | } 3 | 4 | my package EXPORTHOW { 5 | class DECLARE::controller is Metamodel::ClassHOW { 6 | method compose(Mu $type) { 7 | self.add_role($type, Controller); 8 | callsame; 9 | } 10 | } 11 | } 12 | 13 | # vim: expandtab shiftwidth=4 14 | -------------------------------------------------------------------------------- /packages/S12-meta/lib/DeclareBad.rakumod: -------------------------------------------------------------------------------- 1 | my package EXPORTHOW { 2 | class DECLARE::class is Metamodel::ClassHOW { 3 | } 4 | } 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/S12-meta/lib/InvalidDirective.rakumod: -------------------------------------------------------------------------------- 1 | my package EXPORTHOW { 2 | class BBQ::class { } 3 | } 4 | 5 | # vim: expandtab shiftwidth=4 6 | -------------------------------------------------------------------------------- /packages/S12-meta/lib/MultiDeclare.rakumod: -------------------------------------------------------------------------------- 1 | package EXPORTHOW { 2 | package DECLARE { 3 | class pokemon is Metamodel::ClassHOW {} 4 | class digimon is Metamodel::ClassHOW {} 5 | } 6 | } 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /packages/S12-meta/lib/Supersede1.rakumod: -------------------------------------------------------------------------------- 1 | my package EXPORTHOW { 2 | class SUPERSEDE::class is Metamodel::ClassHOW { 3 | method tryit($) { 'pony' } 4 | } 5 | } 6 | 7 | # vim: expandtab shiftwidth=4 8 | -------------------------------------------------------------------------------- /packages/S12-meta/lib/Supersede2.rakumod: -------------------------------------------------------------------------------- 1 | my package EXPORTHOW { 2 | class SUPERSEDE::class is Metamodel::ClassHOW { 3 | } 4 | } 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/S12-meta/lib/SupersedeBad.rakumod: -------------------------------------------------------------------------------- 1 | my package EXPORTHOW { 2 | class SUPERSEDE::nobody-will-add-this-declarator is Metamodel::ClassHOW { 3 | } 4 | } 5 | 6 | # vim: expandtab shiftwidth=4 7 | -------------------------------------------------------------------------------- /packages/S12-meta/lib/TestHOW.rakumod: -------------------------------------------------------------------------------- 1 | class TestHOW is Metamodel::ClassHOW { 2 | method add_method(Mu $obj, $name, $code) 3 | { callsame; } 4 | } 5 | my package EXPORTHOW {} 6 | EXPORTHOW:: = TestHOW; 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /packages/S14-roles/lib/Ver6c.rakumod: -------------------------------------------------------------------------------- 1 | use v6.c; 2 | 3 | role VerRole is export { } 4 | 5 | class Cv6c is export { } 6 | 7 | enum Enum-v6c is export ; 8 | 9 | role R6c_1 is export { 10 | submethod r6c { } 11 | } 12 | 13 | role R6c_2[@stages] { 14 | submethod BUILD { 15 | @stages.push: $?ROLE.^name ~ ".BUILD"; 16 | } 17 | submethod TWEAK { 18 | @stages.push: $?ROLE.^name ~ ".TWEAK"; 19 | } 20 | } 21 | 22 | # vim: expandtab shiftwidth=4 23 | -------------------------------------------------------------------------------- /packages/S14-roles/lib/Ver6e.rakumod: -------------------------------------------------------------------------------- 1 | use v6.e.PREVIEW; 2 | use Ver6c; 3 | 4 | role VerRole[::T] is export { } 5 | 6 | class Cv6e is export { } 7 | 8 | enum Enum-v6e is export ; 9 | 10 | role R6e_1 { 11 | submethod r6e { } 12 | } 13 | 14 | role R6e_2[@stages] { 15 | submethod BUILD { 16 | @stages.push: $?ROLE.^name ~ ".BUILD"; 17 | } 18 | submethod TWEAK { 19 | @stages.push: $?ROLE.^name ~ ".TWEAK"; 20 | } 21 | } 22 | 23 | # vim: expandtab shiftwidth=4 24 | -------------------------------------------------------------------------------- /packages/Test-Helpers/META6.json: -------------------------------------------------------------------------------- 1 | { 2 | "perl" : "6.*", 3 | "name" : "Test::Helpers", 4 | "description" : "Helper and utility modules used in the roast", 5 | "provides" : { 6 | "Test::Assuming" : "lib/Test/Assuming.rakumod", 7 | "Test::Compile" : "lib/Test/Compile.rakumod", 8 | "Test::Idempotence" : "lib/Test/Idempotence.rakumod", 9 | "Test::Iterator" : "lib/Test/Iterator.rakumod", 10 | "Test::Misc" : "lib/Test/Misc.rakumod", 11 | "Test::Tap" : "lib/Test/Tap.rakumod", 12 | "Test::Util" : "lib/Test/Util.rakumod" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/UseTest/lib/UseTest.rakumod: -------------------------------------------------------------------------------- 1 | use v6; 2 | class Stupid::Class { 3 | has $.attrib is rw; 4 | method setter($x) { $.attrib = $x; } 5 | method getter { $.attrib }; 6 | } 7 | 8 | # vim: expandtab shiftwidth=4 9 | -------------------------------------------------------------------------------- /t/01-implname.in: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 9; 5 | 6 | is 2**2, 4; 7 | #?impl-1 todo 'NYI' 8 | is 2+2, 4; 9 | #?impl-2 skip 'NYI' 10 | { 11 | is "Life, the Universe and Everything".WHY, 42; 12 | is 42.WHAT, Int, 'some reason'; 13 | } 14 | #?impl-1 2 todo 'NYI' 15 | #?impl-2 2 todo 'NYI' 16 | is 2-2, 0; 17 | is 3*4, 12; 18 | #?impl-1 2 todo 'NYI' 19 | #?impl-2 1 todo 'NYI' 20 | is 2-2, 0; 21 | is 3*4, 12; 22 | 23 | #?impl-1.backend todo 'NYI' 24 | is +1, 1; 25 | -------------------------------------------------------------------------------- /t/01-implname.out_impl-1: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 9; 5 | 6 | is 2**2, 4; 7 | #?impl-1 todo 'NYI' 8 | todo('NYI'); is 2+2, 4; 9 | #?impl-2 skip 'NYI' 10 | { 11 | is "Life, the Universe and Everything".WHY, 42; 12 | is 42.WHAT, Int, 'some reason'; 13 | } 14 | #?impl-1 2 todo 'NYI' 15 | #?impl-2 2 todo 'NYI' 16 | todo('NYI'); is 2-2, 0; 17 | todo('NYI'); is 3*4, 12; 18 | #?impl-1 2 todo 'NYI' 19 | #?impl-2 1 todo 'NYI' 20 | todo('NYI'); is 2-2, 0; 21 | todo('NYI'); is 3*4, 12; 22 | 23 | #?impl-1.backend todo 'NYI' 24 | is +1, 1; 25 | 26 | say "# FUDGED!"; 27 | exit(1); 28 | -------------------------------------------------------------------------------- /t/01-implname.out_impl-1.backend: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 9; 5 | 6 | is 2**2, 4; 7 | #?impl-1 todo 'NYI' 8 | todo('NYI'); is 2+2, 4; 9 | #?impl-2 skip 'NYI' 10 | { 11 | is "Life, the Universe and Everything".WHY, 42; 12 | is 42.WHAT, Int, 'some reason'; 13 | } 14 | #?impl-1 2 todo 'NYI' 15 | #?impl-2 2 todo 'NYI' 16 | todo('NYI'); is 2-2, 0; 17 | todo('NYI'); is 3*4, 12; 18 | #?impl-1 2 todo 'NYI' 19 | #?impl-2 1 todo 'NYI' 20 | todo('NYI'); is 2-2, 0; 21 | todo('NYI'); is 3*4, 12; 22 | 23 | #?impl-1.backend todo 'NYI' 24 | todo('NYI'); is +1, 1; 25 | 26 | say "# FUDGED!"; 27 | exit(1); 28 | -------------------------------------------------------------------------------- /t/01-implname.out_impl-2: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 9; 5 | 6 | is 2**2, 4; 7 | #?impl-1 todo 'NYI' 8 | is 2+2, 4; 9 | #?impl-2 skip 'NYI' 10 | skip('NYI', 2);# { 11 | # is "Life, the Universe and Everything".WHY, 42; 12 | # is 42.WHAT, Int, 'some reason'; 13 | # } 14 | #?impl-1 2 todo 'NYI' 15 | #?impl-2 2 todo 'NYI' 16 | todo('NYI'); is 2-2, 0; 17 | todo('NYI'); is 3*4, 12; 18 | #?impl-1 2 todo 'NYI' 19 | #?impl-2 1 todo 'NYI' 20 | todo('NYI'); is 2-2, 0; 21 | is 3*4, 12; 22 | 23 | #?impl-1.backend todo 'NYI' 24 | is +1, 1; 25 | 26 | say "# FUDGED!"; 27 | exit(1); 28 | -------------------------------------------------------------------------------- /t/02-version.in: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 8; 5 | 6 | is 2**2, 4; 7 | #?v6.0.0 8 | is 2+2, 4; 9 | #?v6.0.5+ 'GH issue #xyz' 10 | { 11 | is "Life, the Universe and Everything".WHY, 42; 12 | is 42.WHAT, Int, 'some reason'; 13 | } 14 | #?v6.0.0..v6.0.2 2 15 | is 2-2, 0; 16 | is 3*4, 12; 17 | #?v6.0.1..* 18 | is 2-2, 0; 19 | is 3*4, 12; 20 | -------------------------------------------------------------------------------- /t/02-version.out_v6.0.0: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 8; 5 | 6 | is 2**2, 4; 7 | #?v6.0.0 8 | is 2+2, 4; 9 | #?v6.0.5+ 'GH issue #xyz' 10 | skip('GH issue #xyz', 2);# { 11 | # is "Life, the Universe and Everything".WHY, 42; 12 | # is 42.WHAT, Int, 'some reason'; 13 | # } 14 | #?v6.0.0..v6.0.2 2 15 | is 2-2, 0; 16 | is 3*4, 12; 17 | #?v6.0.1..* 18 | skip('Version v6.0.1..* required', 1); # { is 2-2, 0; 19 | # } 20 | is 3*4, 12; 21 | 22 | say "# FUDGED!"; 23 | exit(1); 24 | -------------------------------------------------------------------------------- /t/02-version.out_v6.0.3: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 8; 5 | 6 | is 2**2, 4; 7 | #?v6.0.0 8 | skip('Version v6.0.0 required', 1); # { is 2+2, 4; 9 | # } 10 | #?v6.0.5+ 'GH issue #xyz' 11 | skip('GH issue #xyz', 2);# { 12 | # is "Life, the Universe and Everything".WHY, 42; 13 | # is 42.WHAT, Int, 'some reason'; 14 | # } 15 | #?v6.0.0..v6.0.2 2 16 | skip('Version v6.0.0..v6.0.2 required', 1); # { is 2-2, 0; 17 | # } 18 | skip('Version v6.0.0..v6.0.2 required', 1); # { is 3*4, 12; 19 | # } 20 | #?v6.0.1..* 21 | is 2-2, 0; 22 | is 3*4, 12; 23 | 24 | say "# FUDGED!"; 25 | exit(1); 26 | -------------------------------------------------------------------------------- /t/02-version.out_v6.1.0: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 8; 5 | 6 | is 2**2, 4; 7 | #?v6.0.0 8 | skip('Version v6.0.0 required', 1); # { is 2+2, 4; 9 | # } 10 | #?v6.0.5+ 'GH issue #xyz' 11 | { 12 | is "Life, the Universe and Everything".WHY, 42; 13 | is 42.WHAT, Int, 'some reason'; 14 | } 15 | #?v6.0.0..v6.0.2 2 16 | skip('Version v6.0.0..v6.0.2 required', 1); # { is 2-2, 0; 17 | # } 18 | skip('Version v6.0.0..v6.0.2 required', 1); # { is 3*4, 12; 19 | # } 20 | #?v6.0.1..* 21 | is 2-2, 0; 22 | is 3*4, 12; 23 | 24 | say "# FUDGED!"; 25 | exit(1); 26 | -------------------------------------------------------------------------------- /t/03-count.in: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 3; 5 | 6 | sub same-type ($x, $y) { 7 | is $x.WHAT, $y.WHAT; 8 | ok $x.WHAT ~~ $y.WHAT; 9 | } 10 | 11 | #?v6.0.5 2 12 | #?DOES 2 13 | { 14 | same-type(42, 4); 15 | } 16 | is 3*4, 12; 17 | -------------------------------------------------------------------------------- /t/03-count.out_v6.0.0: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 3; 5 | 6 | sub same-type ($x, $y) { 7 | is $x.WHAT, $y.WHAT; 8 | ok $x.WHAT ~~ $y.WHAT; 9 | } 10 | 11 | #?v6.0.5 2 12 | #?DOES 2 13 | skip('Version v6.0.5 required', 2);# { 14 | # same-type(42, 4); 15 | # } 16 | skip('Version v6.0.5 required', 1); # { is 3*4, 12; 17 | # } 18 | 19 | say "# FUDGED!"; 20 | exit(1); 21 | -------------------------------------------------------------------------------- /t/04-combinations.in: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 10; 5 | 6 | #?DOES 2 7 | sub same-type ($x, $y) { 8 | is $x.WHAT, $y.WHAT; 9 | ok $x.WHAT ~~ $y.WHAT; 10 | } 11 | 12 | #?v6.0.5+ 4 13 | #?impl 2 skip 'NYI' 14 | is "Life, the Universe and Everything".WHY, 42; 15 | is 42.WHAT, Int, 'some reason'; 16 | #?impl todo 'NYI' 17 | { 18 | same-type(42, 4); 19 | } 20 | #?impl skip 'NYI' 21 | is 2+2, 4; 22 | #?impl skip 'NYI' 23 | is 2-2, 0; 24 | 25 | { 26 | same-type(42, 4); 27 | } 28 | 29 | { 30 | is 1, 1; 31 | #?impl skip 'NYI' 32 | is 2, 2; 33 | } 34 | -------------------------------------------------------------------------------- /t/04-combinations.out_impl.1: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 10; 5 | 6 | #?DOES 2 7 | sub same-type ($x, $y) { 8 | is $x.WHAT, $y.WHAT; 9 | ok $x.WHAT ~~ $y.WHAT; 10 | } 11 | 12 | #?v6.0.5+ 4 13 | #?impl 2 skip 'NYI' 14 | skip('Version v6.0.5+ required', 1); # { is "Life, the Universe and Everything".WHY, 42; 15 | # } 16 | skip('Version v6.0.5+ required', 1); # { is 42.WHAT, Int, 'some reason'; 17 | # } 18 | #?impl todo 'NYI' 19 | skip('Version v6.0.5+ required', 2);# { 20 | # same-type(42, 4); 21 | # } 22 | #?impl skip 'NYI' 23 | skip('Version v6.0.5+ required', 1); # { is 2+2, 4; 24 | # } 25 | #?impl skip 'NYI' 26 | skip('NYI', 1); # { is 2-2, 0; 27 | # } 28 | 29 | { 30 | same-type(42, 4); 31 | } 32 | 33 | { 34 | is 1, 1; 35 | #?impl skip 'NYI' 36 | skip('NYI', 1); # { is 2, 2; 37 | # } 38 | } 39 | 40 | say "# FUDGED!"; 41 | exit(1); 42 | -------------------------------------------------------------------------------- /t/04-combinations.out_impl.2: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 10; 5 | 6 | #?DOES 2 7 | sub same-type ($x, $y) { 8 | is $x.WHAT, $y.WHAT; 9 | ok $x.WHAT ~~ $y.WHAT; 10 | } 11 | 12 | #?v6.0.5+ 4 13 | #?impl 2 skip 'NYI' 14 | skip('NYI', 1); # { is "Life, the Universe and Everything".WHY, 42; 15 | # } 16 | skip('NYI', 1); # { is 42.WHAT, Int, 'some reason'; 17 | # } 18 | #?impl todo 'NYI' 19 | { 20 | todo('NYI'); same-type(42, 4); 21 | } 22 | #?impl skip 'NYI' 23 | skip('NYI', 1); # { is 2+2, 4; 24 | # } 25 | #?impl skip 'NYI' 26 | skip('NYI', 1); # { is 2-2, 0; 27 | # } 28 | 29 | { 30 | same-type(42, 4); 31 | } 32 | 33 | { 34 | is 1, 1; 35 | #?impl skip 'NYI' 36 | skip('NYI', 1); # { is 2, 2; 37 | # } 38 | } 39 | 40 | say "# FUDGED!"; 41 | exit(1); 42 | -------------------------------------------------------------------------------- /t/05-skip.in: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 4; 5 | 6 | #?impl-1 2 skip 'NYI' 7 | is 2+2, 4; 8 | my $bar = 5; 9 | is 2+3, $bar; 10 | 11 | { 12 | #?impl-1 2 skip 'NYI' 13 | is 2*2, 4; 14 | my $bar = 6; 15 | is 2*3, $bar; 16 | } 17 | -------------------------------------------------------------------------------- /t/05-skip.out_impl-1: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 4; 5 | 6 | #?impl-1 2 skip 'NYI' 7 | skip('NYI', 1); # { is 2+2, 4; 8 | # } 9 | my $bar = 5; 10 | skip('NYI', 1); # { is 2+3, $bar; 11 | # } 12 | 13 | { 14 | #?impl-1 2 skip 'NYI' 15 | skip('NYI', 1); # { is 2*2, 4; 16 | # } 17 | my $bar = 6; 18 | skip('NYI', 1); # { is 2*3, $bar; 19 | # } 20 | } 21 | 22 | say "# FUDGED!"; 23 | exit(1); 24 | -------------------------------------------------------------------------------- /t/06-todo.in: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 2; 5 | 6 | use lib ; 7 | 8 | use Test::Util; 9 | 10 | #?impl-1 todo 'NYI' 11 | { 12 | is 4, 13 | 4; 14 | } 15 | 16 | #?impl-1 todo 'nom regression' 17 | #?impl-2 todo 'copied nom regression' 18 | is_run 'sub MAIN(:$x) { print $x }', 19 | { 20 | out => "23", 21 | }, 22 | :args['-x=23'], 23 | 'option with spacey value'; 24 | -------------------------------------------------------------------------------- /t/06-todo.out_impl-1: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 2; 5 | 6 | use lib ; 7 | 8 | use Test::Util; 9 | 10 | #?impl-1 todo 'NYI' 11 | { 12 | todo('NYI'); is 4, 13 | 4; 14 | } 15 | 16 | #?impl-1 todo 'nom regression' 17 | #?impl-2 todo 'copied nom regression' 18 | todo('nom regression'); is_run 'sub MAIN(:$x) { print $x }', 19 | { 20 | out => "23", 21 | }, 22 | :args['-x=23'], 23 | 'option with spacey value'; 24 | 25 | say "# FUDGED!"; 26 | exit(1); 27 | -------------------------------------------------------------------------------- /t/07-register_function.in: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 2; 5 | 6 | #?DOES 1 7 | sub registered_function ($x) { $x }; 8 | 9 | #?impl-1 todo 'NYI' 10 | registered_function 2; 11 | ok 4; 12 | 13 | #?impl-1 skip 'NYI' 14 | { 15 | not_registered_function 2; 16 | ok 4; 17 | } 18 | -------------------------------------------------------------------------------- /t/07-register_function.out_impl-1: -------------------------------------------------------------------------------- 1 | use v6; 2 | use Test; 3 | 4 | plan 2; 5 | 6 | #?DOES 1 7 | sub registered_function ($x) { $x }; 8 | 9 | #?impl-1 todo 'NYI' 10 | todo('NYI'); registered_function 2; 11 | ok 4; 12 | 13 | #?impl-1 skip 'NYI' 14 | skip('NYI', 1);# { 15 | # not_registered_function 2; 16 | # ok 4; 17 | # } 18 | 19 | say "# FUDGED!"; 20 | exit(1); 21 | -------------------------------------------------------------------------------- /t/README: -------------------------------------------------------------------------------- 1 | This directory is used to test fudge itself. 2 | The tests in this dir are not part of the 3 | language specification. 4 | --------------------------------------------------------------------------------