mirror of
https://github.com/github/semantic.git
synced 2024-12-24 15:35:14 +03:00
add ruby
This commit is contained in:
parent
0ac705b0f5
commit
be2d90f029
@ -7,12 +7,17 @@ import Data.Monoid
|
|||||||
pyEval :: FilePath -> Benchmarkable
|
pyEval :: FilePath -> Benchmarkable
|
||||||
pyEval = whnfIO . evaluatePythonFile . ("bench/bench-fixtures/python/" <>)
|
pyEval = whnfIO . evaluatePythonFile . ("bench/bench-fixtures/python/" <>)
|
||||||
|
|
||||||
|
rbEval :: FilePath -> Benchmarkable
|
||||||
|
rbEval = whnfIO . evaluateRubyFile . ("bench/bench-fixtures/ruby/" <>)
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = defaultMain [
|
main = defaultMain
|
||||||
bgroup "python" [ bench "assignment" $ pyEval "simple-assignment.py"
|
[ bgroup "python" [ bench "assignment" $ pyEval "simple-assignment.py"
|
||||||
, bench "function def" $ pyEval "function-definition.py"
|
, bench "function def" $ pyEval "function-definition.py"
|
||||||
, bench "if + function calls" $ pyEval "if-statement-functions.py"
|
, bench "if + function calls" $ pyEval "if-statement-functions.py"
|
||||||
]
|
]
|
||||||
|
, bgroup "ruby" [ bench "assignment" $ rbEval "simple-assignment.rb"
|
||||||
|
, bench "function def" $ rbEval "function-definition.rb"
|
||||||
|
, bench "if + function calls" $ rbEval "if-statement-functions.rb"
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
@ -4,11 +4,11 @@ def a():
|
|||||||
def c(d):
|
def c(d):
|
||||||
e
|
e
|
||||||
|
|
||||||
def g(g, *h,):
|
def g(g, *h):
|
||||||
i
|
i
|
||||||
|
|
||||||
def h(i=j):
|
def h(i=1):
|
||||||
i
|
i
|
||||||
|
|
||||||
def i(j:str="default", **c):
|
def i(j="default", **c):
|
||||||
j
|
j
|
||||||
|
@ -2,11 +2,11 @@ def foo(): return "bipp"
|
|||||||
|
|
||||||
def bar(): return foo()
|
def bar(): return foo()
|
||||||
|
|
||||||
def baz(): return baz()
|
def baz(): return bar()
|
||||||
|
|
||||||
def why(): return "elle"
|
def why(): return "elle"
|
||||||
|
|
||||||
if True:
|
if True:
|
||||||
foo()
|
baz()
|
||||||
else:
|
else:
|
||||||
why()
|
why()
|
||||||
|
19
bench/bench-fixtures/ruby/function-definition.rb
Normal file
19
bench/bench-fixtures/ruby/function-definition.rb
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
def a()
|
||||||
|
"b"
|
||||||
|
end
|
||||||
|
|
||||||
|
def c(d)
|
||||||
|
"e"
|
||||||
|
end
|
||||||
|
|
||||||
|
def g(g_)
|
||||||
|
"i"
|
||||||
|
end
|
||||||
|
|
||||||
|
def h(i=1)
|
||||||
|
i
|
||||||
|
end
|
||||||
|
|
||||||
|
def i()
|
||||||
|
"j"
|
||||||
|
end
|
21
bench/bench-fixtures/ruby/if-statement-functions.rb
Normal file
21
bench/bench-fixtures/ruby/if-statement-functions.rb
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
def foo()
|
||||||
|
"bipp"
|
||||||
|
end
|
||||||
|
|
||||||
|
def bar()
|
||||||
|
foo()
|
||||||
|
end
|
||||||
|
|
||||||
|
def baz()
|
||||||
|
bar()
|
||||||
|
end
|
||||||
|
|
||||||
|
def why()
|
||||||
|
return "elle"
|
||||||
|
end
|
||||||
|
|
||||||
|
if true
|
||||||
|
baz()
|
||||||
|
else
|
||||||
|
why()
|
||||||
|
end
|
5
bench/bench-fixtures/ruby/simple-assignment.rb
Normal file
5
bench/bench-fixtures/ruby/simple-assignment.rb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
foo = 2
|
||||||
|
bar = foo
|
||||||
|
dang = 3
|
||||||
|
song = dang
|
||||||
|
song
|
Loading…
Reference in New Issue
Block a user