Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
8aff6f50
Commit
8aff6f50
authored
Mar 24, 2014
by
Torkel Ödegaard
Committed by
Bruce Sherrod
Mar 26, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #223, float arguments to functions like scale should now work as expected
parent
b2aca66e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
2 deletions
+19
-2
src/app/services/graphite/gfunc.js
+1
-1
src/test/specs/gfunc-specs.js
+5
-1
src/test/specs/lexer-specs.js
+6
-0
src/test/specs/parser-specs.js
+7
-0
No files found.
src/app/services/graphite/gfunc.js
View file @
8aff6f50
...
...
@@ -365,7 +365,7 @@ function (_) {
this
.
params
.
splice
(
index
,
1
);
}
else
if
(
this
.
def
.
params
[
index
].
type
===
'int'
)
{
this
.
params
[
index
]
=
parse
In
t
(
strValue
,
10
);
this
.
params
[
index
]
=
parse
Floa
t
(
strValue
,
10
);
}
else
{
this
.
params
[
index
]
=
strValue
;
...
...
src/test/specs/gfunc-specs.js
View file @
8aff6f50
...
...
@@ -71,7 +71,11 @@ define([
expect
(
func
.
text
).
to
.
be
(
'summarize(1h, sum)'
);
});
it
(
'should parse numbers as float'
,
function
()
{
var
func
=
gfunc
.
createFuncInstance
(
'scale'
);
func
.
updateParam
(
'0.001'
,
0
);
expect
(
func
.
params
[
0
]).
to
.
be
(
0.001
);
});
});
describe
(
'when updating func param with optional second parameter'
,
function
()
{
...
...
src/test/specs/lexer-specs.js
View file @
8aff6f50
...
...
@@ -88,6 +88,12 @@ define([
expect
(
tokens
[
4
].
pos
).
to
.
be
(
20
);
});
it
(
'should handle float parameters'
,
function
()
{
var
lexer
=
new
Lexer
(
"alias(metric, 0.002)"
);
var
tokens
=
lexer
.
tokenize
();
expect
(
tokens
[
4
].
type
).
to
.
be
(
'number'
);
expect
(
tokens
[
4
].
value
).
to
.
be
(
'0.002'
);
});
});
...
...
src/test/specs/parser-specs.js
View file @
8aff6f50
...
...
@@ -139,6 +139,13 @@ define([
expect
(
rootNode
.
type
).
to
.
be
(
'function'
);
});
it
(
'handle float function arguments'
,
function
()
{
var
parser
=
new
Parser
(
'scale(test, 0.002)'
);
var
rootNode
=
parser
.
getAst
();
expect
(
rootNode
.
type
).
to
.
be
(
'function'
);
expect
(
rootNode
.
params
[
1
].
type
).
to
.
be
(
'number'
);
expect
(
rootNode
.
params
[
1
].
value
).
to
.
be
(
0.002
);
});
});
...
...
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