Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d4ccce8d
Commit
d4ccce8d
authored
Feb 19, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Feb 19, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Added RegExp.Execute tests.
parent
e618241c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
190 additions
and
4 deletions
+190
-4
regexp.vbs
dlls/vbscript/tests/regexp.vbs
+171
-0
rsrc.rc
dlls/vbscript/tests/rsrc.rc
+3
-0
run.c
dlls/vbscript/tests/run.c
+16
-4
No files found.
dlls/vbscript/tests/regexp.vbs
0 → 100644
View file @
d4ccce8d
'
' Copyright 2013 Piotr Caban for CodeWeavers
'
' This library is free software; you can redistribute it and/or
' modify it under the terms of the GNU Lesser General Public
' License as published by the Free Software Foundation; either
' version 2.1 of the License, or (at your option) any later version.
'
' This library is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
' Lesser General Public License for more details.
'
' You should have received a copy of the GNU Lesser General Public
' License along with this library; if not, write to the Free Software
' Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
'
Option
Explicit
Dim
x
,
matches
,
match
,
submatch
Set
x
=
CreateObject
(
"vbscript.regexp"
)
Call
ok
(
getVT
(
x
.
Pattern
)
=
"VT_BSTR"
,
"getVT(RegExp.Pattern) = "
&
getVT
(
x
.
Pattern
))
Call
ok
(
x
.
Pattern
=
""
,
"RegExp.Pattern = "
&
x
.
Pattern
)
Call
ok
(
getVT
(
x
.
IgnoreCase
)
=
"VT_BOOL"
,
"getVT(RegExp.IgnoreCase) = "
&
getVT
(
x
.
IgnoreCase
))
Call
ok
(
x
.
IgnoreCase
=
false
,
"RegExp.IgnoreCase = "
&
x
.
IgnoreCase
)
Call
ok
(
getVT
(
x
.
Global
)
=
"VT_BOOL"
,
"getVT(RegExp.Global) = "
&
getVT
(
x
.
Global
))
Call
ok
(
x
.
Global
=
false
,
"RegExp.Global = "
&
x
.
Global
)
Call
ok
(
getVT
(
x
.
Multiline
)
=
"VT_BOOL"
,
"getVT(RegExp.Multiline) = "
&
getVT
(
x
.
Multiline
))
Call
ok
(
x
.
Multiline
=
false
,
"RegExp.Multiline = "
&
x
.
Multiline
)
x
.
Pattern
=
"a+"
matches
=
x
.
Test
(
" aabaaa"
)
Call
ok
(
matches
=
true
,
"RegExp.Test returned: "
&
matches
)
Set
matches
=
x
.
Execute
(
" aabaaa"
)
Call
ok
(
getVT
(
matches
.
Count
)
=
"VT_I4"
,
"getVT(matches.Count) = "
&
getVT
(
matches
.
Count
))
Call
ok
(
matches
.
Count
=
1
,
"matches.Count = "
&
matches
.
Count
)
Set
match
=
matches
.
Item
(
0
)
Call
ok
(
match
.
Value
=
"aa"
,
"match.Value = "
&
match
.
Value
)
Call
ok
(
match
.
FirstIndex
=
1
,
"match.FirstIndex = "
&
match
.
FirstIndex
)
Call
ok
(
match
.
Length
=
2
,
"match.Length = "
&
match
.
Length
)
Set
submatch
=
match
.
SubMatches
Call
ok
(
submatch
.
Count
=
0
,
"submatch.Count = "
&
submatch
.
Count
)
x
.
Global
=
true
Set
matches
=
x
.
Execute
(
" aabaaa"
)
Call
ok
(
matches
.
Count
=
2
,
"matches.Count = "
&
matches
.
Count
)
Set
match
=
matches
.
Item
(
0
)
Call
ok
(
match
.
Value
=
"aa"
,
"match.Value = "
&
match
.
Value
)
Call
ok
(
match
.
FirstIndex
=
1
,
"match.FirstIndex = "
&
match
.
FirstIndex
)
Call
ok
(
match
.
Length
=
2
,
"match.Length = "
&
match
.
Length
)
Set
submatch
=
match
.
SubMatches
Call
ok
(
submatch
.
Count
=
0
,
"submatch.Count = "
&
submatch
.
Count
)
Set
match
=
matches
.
Item
(
1
)
Call
ok
(
match
.
Value
=
"aaa"
,
"match.Value = "
&
match
.
Value
)
Call
ok
(
match
.
FirstIndex
=
4
,
"match.FirstIndex = "
&
match
.
FirstIndex
)
Call
ok
(
match
.
Length
=
3
,
"match.Length = "
&
match
.
Length
)
Set
submatch
=
match
.
SubMatches
Call
ok
(
submatch
.
Count
=
0
,
"submatch.Count = "
&
submatch
.
Count
)
Set
matches
=
x
.
Execute
(
" aabaaa"
)
Call
ok
(
matches
.
Count
=
2
,
"matches.Count = "
&
matches
.
Count
)
Set
match
=
matches
.
Item
(
0
)
Call
ok
(
match
.
Value
=
"aa"
,
"match.Value = "
&
match
.
Value
)
Call
ok
(
match
.
FirstIndex
=
1
,
"match.FirstIndex = "
&
match
.
FirstIndex
)
Call
ok
(
match
.
Length
=
2
,
"match.Length = "
&
match
.
Length
)
Set
submatch
=
match
.
SubMatches
Call
ok
(
submatch
.
Count
=
0
,
"submatch.Count = "
&
submatch
.
Count
)
x
.
Pattern
=
"^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$"
x
.
Global
=
false
Set
matches
=
x
.
Execute
(
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
)
Call
ok
(
matches
.
Count
=
0
,
"matches.Count = "
&
matches
.
Count
)
Set
submatch
=
match
.
SubMatches
Call
ok
(
submatch
.
Count
=
0
,
"submatch.Count = "
&
submatch
.
Count
)
x
.
Pattern
=
"(a|b)+|(c)"
Set
matches
=
x
.
Execute
(
"aa"
)
Call
ok
(
matches
.
Count
=
1
,
"matches.Count = "
&
matches
.
Count
)
Set
match
=
matches
.
Item
(
0
)
Call
ok
(
match
.
Value
=
"aa"
,
"match.Value = "
&
match
.
Value
)
Call
ok
(
match
.
FirstIndex
=
0
,
"match.FirstIndex = "
&
match
.
FirstIndex
)
Call
ok
(
match
.
Length
=
2
,
"match.Length = "
&
match
.
Length
)
Set
submatch
=
match
.
SubMatches
Call
ok
(
submatch
.
Count
=
2
,
"submatch.Count = "
&
submatch
.
Count
)
Call
ok
(
getVT
(
submatch
.
Item
(
0
))
=
"VT_BSTR"
,
"getVT(submatch.Item(0)) = "
&
getVT
(
submatch
.
Item
(
0
)))
Call
ok
(
submatch
.
Item
(
0
)
=
"a"
,
"submatch.Item(0) = "
&
submatch
.
Item
(
0
))
Call
ok
(
getVT
(
submatch
.
Item
(
1
))
=
"VT_EMPTY"
,
"getVT(submatch.Item(1)) = "
&
getVT
(
submatch
.
Item
(
1
)))
Call
ok
(
submatch
.
Item
(
1
)
=
""
,
"submatch.Item(0) = "
&
submatch
.
Item
(
1
))
matches
=
x
.
Test
(
" a "
)
Call
ok
(
matches
=
true
,
"RegExp.Test returned: "
&
matches
)
matches
=
x
.
Test
(
" a "
)
Call
ok
(
matches
=
true
,
"RegExp.Test returned: "
&
matches
)
x
.
Pattern
=
"\[([^\[]+)\]"
x
.
Global
=
true
Set
matches
=
x
.
Execute
(
" [test] "
)
Call
ok
(
matches
.
Count
=
1
,
"matches.Count = "
&
matches
.
Count
)
Set
match
=
matches
.
Item
(
0
)
Call
ok
(
match
.
Value
=
"[test]"
,
"match.Value = "
&
match
.
Value
)
Call
ok
(
match
.
FirstIndex
=
1
,
"match.FirstIndex = "
&
match
.
FirstIndex
)
Call
ok
(
match
.
Length
=
6
,
"match.Length = "
&
match
.
Length
)
Set
submatch
=
match
.
SubMatches
Call
ok
(
submatch
.
Count
=
1
,
"submatch.Count = "
&
submatch
.
Count
)
Call
ok
(
submatch
.
Item
(
0
)
=
"test"
,
"submatch.Item(0) = "
&
submatch
.
Item
(
0
))
x
.
Pattern
=
"Ab"
x
.
IgnoreCase
=
true
Set
matches
=
x
.
Execute
(
"abcaBc"
)
Call
ok
(
matches
.
Count
=
2
,
"matches.Count = "
&
matches
.
Count
)
Set
match
=
matches
.
Item
(
0
)
Call
ok
(
match
.
Value
=
"ab"
,
"match.Value = "
&
match
.
Value
)
Call
ok
(
match
.
FirstIndex
=
0
,
"match.FirstIndex = "
&
match
.
FirstIndex
)
Call
ok
(
match
.
Length
=
2
,
"match.Length = "
&
match
.
Length
)
Set
submatch
=
match
.
SubMatches
Call
ok
(
submatch
.
Count
=
0
,
"submatch.Count = "
&
submatch
.
Count
)
Set
match
=
matches
.
Item
(
1
)
Call
ok
(
match
.
Value
=
"aB"
,
"match.Value = "
&
match
.
Value
)
Call
ok
(
match
.
FirstIndex
=
3
,
"match.FirstIndex = "
&
match
.
FirstIndex
)
Call
ok
(
match
.
Length
=
2
,
"match.Length = "
&
match
.
Length
)
Set
submatch
=
match
.
SubMatches
Call
ok
(
submatch
.
Count
=
0
,
"submatch.Count = "
&
submatch
.
Count
)
x
.
Pattern
=
"a+b"
x
.
IgnoreCase
=
false
Set
matches
=
x
.
Execute
(
"aaabcabc"
)
Call
ok
(
matches
.
Count
=
2
,
"matches.Count = "
&
matches
.
Count
)
Set
match
=
matches
.
Item
(
0
)
Call
ok
(
match
.
Value
=
"aaab"
,
"match.Value = "
&
match
.
Value
)
Call
ok
(
match
.
FirstIndex
=
0
,
"match.FirstIndex = "
&
match
.
FirstIndex
)
Call
ok
(
match
.
Length
=
4
,
"match.Length = "
&
match
.
Length
)
Set
submatch
=
match
.
SubMatches
Call
ok
(
submatch
.
Count
=
0
,
"submatch.Count = "
&
submatch
.
Count
)
Set
match
=
matches
.
Item
(
1
)
Call
ok
(
match
.
Value
=
"ab"
,
"match.Value = "
&
match
.
Value
)
Call
ok
(
match
.
FirstIndex
=
5
,
"match.FirstIndex = "
&
match
.
FirstIndex
)
Call
ok
(
match
.
Length
=
2
,
"match.Length = "
&
match
.
Length
)
Set
submatch
=
match
.
SubMatches
Call
ok
(
submatch
.
Count
=
0
,
"submatch.Count = "
&
submatch
.
Count
)
x
.
Pattern
=
"\\"
Set
matches
=
x
.
Execute
(
"aaa\\cabc"
)
Call
ok
(
matches
.
Count
=
2
,
"matches.Count = "
&
matches
.
Count
)
Set
match
=
matches
.
Item
(
0
)
Call
ok
(
match
.
Value
=
"\"
,
"match.Value = "
&
match
.
Value
)
Call
ok
(
match
.
FirstIndex
=
3
,
"match.FirstIndex = "
&
match
.
FirstIndex
)
Call
ok
(
match
.
Length
=
1
,
"match.Length = "
&
match
.
Length
)
Set
submatch
=
match
.
SubMatches
Call
ok
(
submatch
.
Count
=
0
,
"submatch.Count = "
&
submatch
.
Count
)
Set
match
=
matches
.
Item
(
1
)
Call
ok
(
match
.
Value
=
"\"
,
"match.Value = "
&
match
.
Value
)
Call
ok
(
match
.
FirstIndex
=
4
,
"match.FirstIndex = "
&
match
.
FirstIndex
)
Call
ok
(
match
.
Length
=
1
,
"match.Length = "
&
match
.
Length
)
Set
submatch
=
match
.
SubMatches
Call
ok
(
submatch
.
Count
=
0
,
"submatch.Count = "
&
submatch
.
Count
)
x
.
Pattern
=
"(a)(b)cabc"
Set
matches
=
x
.
Execute
(
"abcabc"
)
Call
ok
(
matches
.
Count
=
1
,
"matches.Count = "
&
matches
.
Count
)
Set
match
=
matches
.
Item
(
0
)
Call
ok
(
match
.
Value
=
"abcabc"
,
"match.Value = "
&
match
.
Value
)
Call
ok
(
match
.
FirstIndex
=
0
,
"match.FirstIndex = "
&
match
.
FirstIndex
)
Call
ok
(
match
.
Length
=
6
,
"match.Length = "
&
match
.
Length
)
Set
submatch
=
match
.
SubMatches
Call
ok
(
submatch
.
Count
=
2
,
"submatch.Count = "
&
submatch
.
Count
)
Call
ok
(
submatch
.
Item
(
0
)
=
"a"
,
"submatch.Item(0) = "
&
submatch
.
Item
(
0
))
Call
ok
(
submatch
.
Item
(
1
)
=
"b"
,
"submatch.Item(0) = "
&
submatch
.
Item
(
1
))
Call
reportSuccess
()
dlls/vbscript/tests/rsrc.rc
View file @
d4ccce8d
...
@@ -21,3 +21,6 @@ api.vbs 40 "api.vbs"
...
@@ -21,3 +21,6 @@ api.vbs 40 "api.vbs"
/* @makedep: lang.vbs */
/* @makedep: lang.vbs */
lang.vbs 40 "lang.vbs"
lang.vbs 40 "lang.vbs"
/* @makedep: regexp.vbs */
regexp.vbs 40 "regexp.vbs"
dlls/vbscript/tests/run.c
View file @
d4ccce8d
...
@@ -25,6 +25,8 @@
...
@@ -25,6 +25,8 @@
#include <dispex.h>
#include <dispex.h>
#include <activscp.h>
#include <activscp.h>
#include "vbsregexp55.h"
#include "wine/test.h"
#include "wine/test.h"
#ifdef _WIN64
#ifdef _WIN64
...
@@ -48,6 +50,7 @@
...
@@ -48,6 +50,7 @@
#endif
#endif
extern
const
CLSID
CLSID_VBScript
;
extern
const
CLSID
CLSID_VBScript
;
extern
const
CLSID
CLSID_VBScriptRegExp
;
#define DEFINE_EXPECT(func) \
#define DEFINE_EXPECT(func) \
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
...
@@ -1920,6 +1923,7 @@ static void run_tests(void)
...
@@ -1920,6 +1923,7 @@ static void run_tests(void)
run_from_res
(
"lang.vbs"
);
run_from_res
(
"lang.vbs"
);
run_from_res
(
"api.vbs"
);
run_from_res
(
"api.vbs"
);
run_from_res
(
"regexp.vbs"
);
test_procedures
();
test_procedures
();
test_gc
();
test_gc
();
...
@@ -1928,13 +1932,21 @@ static void run_tests(void)
...
@@ -1928,13 +1932,21 @@ static void run_tests(void)
static
BOOL
check_vbscript
(
void
)
static
BOOL
check_vbscript
(
void
)
{
{
IActiveScriptParseProcedure2
*
vbscript
;
IRegExp2
*
regexp
;
IUnknown
*
unk
;
HRESULT
hres
;
HRESULT
hres
;
hres
=
CoCreateInstance
(
&
CLSID_VBScript
,
NULL
,
CLSCTX_INPROC_SERVER
|
CLSCTX_INPROC_HANDLER
,
hres
=
CoCreateInstance
(
&
CLSID_VBScriptRegExp
,
NULL
,
&
IID_IActiveScriptParseProcedure2
,
(
void
**
)
&
vbscript
);
CLSCTX_INPROC_SERVER
|
CLSCTX_INPROC_HANDLER
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
if
(
hres
==
REGDB_E_CLASSNOTREG
)
return
FALSE
;
ok
(
hres
==
S_OK
,
"CoCreateInstance(CLSID_VBScriptRegExp) failed: %x
\n
"
,
hres
);
hres
=
IUnknown_QueryInterface
(
unk
,
&
IID_IRegExp2
,
(
void
**
)
&
regexp
);
if
(
SUCCEEDED
(
hres
))
if
(
SUCCEEDED
(
hres
))
IActiveScriptParseProcedure2_Release
(
vbscript
);
IRegExp2_Release
(
regexp
);
IUnknown_Release
(
unk
);
return
hres
==
S_OK
;
return
hres
==
S_OK
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment