Comments (8)
Thanks for submiting this issue, i will have a deeper look to understand the problem.
from gdunit3.
After deeper investigation It seams to be it is not a snake case issue.
The doubler try to extend by class name but the class has no class_name defined.
So i need to deside to extend by existing class_name or class_path
from gdunit3.
It's working fine now! Thanks!
from gdunit3.
I made a small and quick fix, but I don't know if it's the best way. Right after the clazz_name
definition, on GdUnitMockBuilder.build
I've added the following:
if "_" in clazz_name or clazz_name == clazz_name.to_lower():
var result = PoolStringArray()
var prev_is_underscore = false
for ch in clazz_name:
if ch=='_':
prev_is_underscore = true
else:
if prev_is_underscore:
result.append(ch.to_upper())
else:
result.append(ch)
prev_is_underscore = false
result[0] = result[0].to_upper()
clazz_name = result.join('')
The logic I got from here. It is working fine for my tests cases.
from gdunit3.
@afonsolage you can alternative use the class name to mock the class instead by path.
mock(main_player)
It needs onyl to add the class name definition in your class
class_name main_player
The fix is now in master and you can mock by class path or name as you want.
from gdunit3.
I'll try it, before even using the class_name
(which was in PascalCase - MainPlayer) didn't worked, but I'll give a try and post here.
from gdunit3.
It worked for main_class.gd
, but not for mob.gd
, since mob.gd is snake_case
but doesn't have underscore. Something like that would fix:
# handle snake_case class names, only if clazz path available and is a GdScript
if "_" in clazz_name and not clazz_path.empty() and (clazz_path[0].find(".gd") != -1):
return "'%s'" % clazz_path[0]
elif not ClassDB.class_exists(clazz_name):
return "'%s'" % clazz_path[0]
return clazz_name
Add a new test case using a lowercaseonly.gd
test file and you should get the problem
from gdunit3.
pushed new fix to master
from gdunit3.
Related Issues (20)
- GD-350: Spinner continues spinning after tests have stopped when debugging a single parameterised test
- GD-351: Scene runner's mouse simulation doesn't trigger drag & drop functions
- GD-353: Update GdUnit Documentation to v2.4.0
- GD-356: Error on console when tests detects an orphan node
- GD-358: Using strings as paramterized test arguments are distorted
- GD-362: Spy on a implemented virtual function like `_input` is not working
- GD-363: Update Documentation, Is class_name on scripts a hard requirement? HOT 1
- GD-367: Running test get stuck under macOS (Runtime mode)
- GD-369: Failure message are incorrectly colored
- GD-370: Spy on a function with return type `Variant` does return any value
- GD-373: `ci-dev` is broken and runs out of time by debug error
- GD-375: Add code coverage metrixs HOT 3
- GD-376: Mocking of a class that uses a custom constructor fails if the argument contains `func` in its name HOT 5
- GD-377: Cant assert equal for PoolTypeArray HOT 3
- GD-379: Documentation: non existing function `Fuzzers.random_rangei()` in example HOT 2
- GD-380: Input events are swallowed when running tests via `GdUnitCmdTool`
- Best way to reuse mocks across several tests? HOT 1
- GD-390: Tests hang when godot.log is not found HOT 1
- assert_signal does not detect emitted signal HOT 1
- all .cs files with namespace GdUnit3 are missing (were present in v2.2.6, gone since v2.3.0) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gdunit3.