summaryrefslogtreecommitdiffhomepage
path: root/test_suite.rb
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2023-02-15 19:14:56 -0500
committerrealtradam <[email protected]>2023-02-15 19:14:56 -0500
commit0e689b72d7fc7afa64508a99948527009712d189 (patch)
tree113a5c52a0ada6dff15a027edb33abf877cf5b96 /test_suite.rb
parent90950ee613c32c248108406a176598d6216e3140 (diff)
downloadmruby-playground-master.tar.gz
mruby-playground-master.zip
struct exampleHEADmaster
Diffstat (limited to 'test_suite.rb')
-rw-r--r--test_suite.rb49
1 files changed, 37 insertions, 12 deletions
diff --git a/test_suite.rb b/test_suite.rb
index 5ceb936..470f7b7 100644
--- a/test_suite.rb
+++ b/test_suite.rb
@@ -1,19 +1,44 @@
puts "Beginning Test Suite..."
puts
-puts " - Basic Example - "
-BasicExample.say_hello
-BasicExample.say_goodbye
-puts
+if Object.const_defined? 'BasicExample'
+ puts " - Basic Example - "
+ BasicExample.say_hello
+ BasicExample.say_goodbye
+ puts
+else
+ puts "Basic Example const not found, skipping test..."
+end
-puts " - Arguments And Return Example - "
-print "3 * 10 = "
-puts ArgumentsAndReturnExample.multiply_numbers(3, 10)
-puts
+if Object.const_defined? 'ArgumentsAndReturnExample'
+ puts " - Arguments And Return Example - "
+ print "3 * 10 = "
+ puts ArgumentsAndReturnExample.multiply_numbers(3, 10)
+ puts
+else
+ puts "Arguments And Return Example const not found, skipping test..."
+end
-puts " - Keyword Arguments Example - "
-print "(x: 4) * (y: 6) = "
-puts KeywordArgumentsExample.multiply_numbers(x: 4, y: 6)
-puts
+if Object.const_defined? 'KeywordArgumentsExample'
+ puts " - Keyword Arguments Example - "
+ print "(x: 4) * (y: 6) = "
+ puts KeywordArgumentsExample.multiply_numbers(x: 4, y: 6)
+ puts
+else
+ puts "Keyword Arguments Example const not found, skipping test..."
+end
+
+if Object.const_defined? 'BasicStructExample'
+ puts " - Basic Struct Example - "
+ puts "Making a new rgb struct with:"
+ puts " r: 10, g: 20, b: 30"
+ color = BasicStructExample::Color.new(10,20,30)
+ puts "Red is #{color.r}"
+ puts "Set red to 60: #{color.r = 60}"
+ puts "Red is #{color.r}"
+ puts
+else
+ puts "Basic Struct Example const not found, skipping test..."
+end
puts "Reached end of test suite."