-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtest.tcl
executable file
·174 lines (158 loc) · 4.15 KB
/
test.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/usr/bin/env tclsh
###############################################################
#
# Test script for eggdrop scripts
#
###############################################################
# CONFIG
set scriptname "urltitle.tcl"
set channel "#testchannel"
set nickname "user"
set uhost "uhost"
set handle "handle"
# start script
set scriptVersion 0.1
set binds [dict create]
puts "Eggdrop script tester $scriptVersion"
proc setudef {type value} {
puts "SETUDEF: $type $value"
}
# handle eggdrop binds
proc bind {type perms cmd proc} {
puts "BIND: $type $perms $cmd $proc"
global binds
# create type if not exists
if {![dict exists $binds $type]} {
dict set binds $type [dict create]
}
# get existing commands of the same type
set d [dict get $binds $type]
# add command to dict
dict set binds $type [dict append d $cmd $proc]
}
# output eggdrop putserv command to stdout
proc putserv {output} {
puts "PUTSERV: $output";
}
# output eggdrop puthelpcommand to stdout
proc puthelp {output} {
puts "PUTHELP: $output";
}
# output egggdrop putlog command to stdout
proc putlog {output} {
puts "PUTLOG: $output";
}
proc matchattr {handle flags {channel ""}} {
return 0
}
proc channel {func name setting} {
return 1
}
# emulate pubm binds
proc pubm {{value ""}} {
puts "PUBM: $value";
global binds
global nickname
global channel
global uhost
global handle
set pubm [dict get $binds "pubm"]
dict for {mask proc} $pubm {
$proc $nickname $uhost $handle $channel $value
}
# if {[dict exists $pubm $cmd]} {
# set p [dict get $pubm $cmd]
# $p $nickname $uhost $handle $channel $value
# return
# }
# puts "ERROR: $cmd does not exists in pubm";
}
# emulate public command
proc pub {cmd {value ""}} {
puts "PUB: $cmd $value";
global binds
global nickname
global channel
global uhost
global handle
set pub [dict get $binds "pub"]
if {[dict exists $pub $cmd]} {
set p [dict get $pub $cmd]
$p $nickname $uhost $handle $channel $value
return
}
puts "ERROR: $cmd does not exists in pub";
}
# emulate msg command
proc msg {cmd {value ""}} {
puts "MSG: $cmd $value";
global binds
global nickname
global uhost
global handle
set msg [dict get $binds "msg"]
if {[dict exists $msg $cmd]} {
set p [dict get $msg $cmd]
$p $nickname $uhost $handle $value
return
}
puts "ERROR: $cmd does not exists in msg";
}
# emulate dcc command
proc dcc {cmd {value ""}} {
puts "DCC: $cmd $value";
global binds
global nickname
global uhost
global handle
set dcc [dict get $binds "dcc"]
if {[dict exists $dcc [string range $cmd 1 999]]} {
set p [dict get $dcc [string range $cmd 1 999]]
$p $nickname $uhost $handle $value
return
}
puts "ERROR: $cmd does not exists in dcc";
}
source $scriptname
# TESTS GO HERE
pubm "Check it out at https://github.com/teeli/urltitle"
after 5000
# multiple title tag tesst
pubm "http://www.rumba.fi/uutiset/kommentti-paskaa-suomi-iskelmaa-tekeva-kotiteollisuus-haluaa-julkisuuteen-julkaisee-levyn/"
after 5000
# SNI TLS test
pubm "https://www.rust-lang.org/en-US/"
after 5000
# SNI TLS test
pubm "https://centmin.sh/"
after 5000
# xpath test 1
pubm "https://pbs.twimg.com/media/C58JTUXXEAIbCUv.jpg"
after 5000
# xpath test 2
pubm "https://www.amazon.com/Bro-Custom-Symbol-Tees-Doggy-Yellow/dp/B01EDXDU4M/"
after 5000
# xpath test 3
pubm "http://img.fark.net/images/cache/850/W/Wt/fark_WtjCu6v522v0PIvoDm2QVLDv97U.jpg?t=3GK9fKLvopse5AD0O7kErA&f=1488776400"
after 5000
# redirect 301 test
pubm "https://www.pastebin.com/"
after 5000
# more tests from githb
pubm "http://www.google.com"
after 5000
pubm "https://www.google.com"
after 5000
pubm "http://google.com"
after 5000
pubm "https://www.google.com"
after 5000
pubm "https://twitter.com/ItMeIRL/status/893133548118564864"
after 5000
# xpath error
pubm "http://blog.dilbert.com/post/164297628606/how-to-know-youre-in-a-mass-hysteria-bubble"
after 5000
# svg title
pubm "https://www.imdb.com/title/tt1025100/"
after 5000
pubm "done"