testability-driver 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -862,7 +862,7 @@ module MobyBehaviour
862
862
  #
863
863
  # lengthvariant
864
864
  # String
865
- # description: Optional LENGTHVAR search argument for the translation (1-9)
865
+ # description: Optional argument to specify a length variant with its priority number (1-9). Translations with no length variants are considered a variant of priority "1". The default 'nil' value will retrieve all variants available.
866
866
  # example: "1"
867
867
  # default: nil
868
868
  #
@@ -40,9 +40,14 @@ module MobyBase
40
40
  @_sutController = sut_controller
41
41
 
42
42
  @test_object_factory = test_object_factory || TDriver::TestObjectFactory.new( :test_object_adapter => TDriver::TestObjectAdapter )
43
-
43
+
44
44
  @id = sut_id
45
- @input = :key
45
+
46
+ # reference to self; easier to access (parent) SUT in shared behaviours applied to test object/sut/application
47
+ @sut = self
48
+
49
+ # default values
50
+ @input = :key
46
51
  @type = "sut"
47
52
 
48
53
  end
@@ -555,18 +555,25 @@ module MobyBase
555
555
  # verify given identification directives, only documented end-user directives is checked
556
556
  identification_directives.each{ | key, value |
557
557
 
558
+ # do not verify type by default
559
+ type = nil
560
+
558
561
  case key
559
562
 
560
563
  # Fixnum
561
- when :__index, :__timeout, :__logging
562
- value.check_type( Fixnum, "Wrong variable type $1 for #{ key.inspect } test object identification directive (expected $2)" )
564
+ when :__index, :__timeout
565
+
566
+ type = Fixnum
567
+
568
+ when :__logging, :__xy_sorting
563
569
 
564
- # TrueClass, FalseClass
565
- when :__xy_sorting
566
- value.check_type( [ TrueClass, FalseClass ], "Wrong variable type $1 for #{ key.inspect } test object identification directive (expected $2)" )
570
+ type = [ TrueClass, FalseClass ]
567
571
 
568
572
  end
569
-
573
+
574
+ # verify hash value if type defined
575
+ value.check_type( type, "Wrong variable type $1 for #{ key.inspect } test object identification directive (expected $2)" ) unless type.nil?
576
+
570
577
  }
571
578
 
572
579
  # get parent object
@@ -541,9 +541,10 @@ module MobyUtil
541
541
  priority += 1
542
542
  end
543
543
  else
544
+ # When no lengthvar is provided we now assign priority '1' by default
544
545
  # puts ">>> Translation"
545
546
  nodeTranslation = node.xpath('.//translation').inner_text()
546
- data << [ fname, nodeId, nodeTranslation, nodePlurality, nodeLengthVar ]
547
+ data << [ fname, nodeId, nodeTranslation, nodePlurality, nodeLengthVar = '1' ]
547
548
  end
548
549
  rescue Exception # ignores bad elements or elements with empty translations for now
549
550
  end
@@ -571,8 +572,9 @@ module MobyUtil
571
572
  while line = io.gets
572
573
  if line.match(/#define ([a-zA-Z1-9\_]*) \"(.*)\"/)
573
574
  lname = $1
574
- translation = $2
575
- data << [ fname, lname, translation, plurality = "", lengthvariant = "0" ]
575
+ translation = $2
576
+ # When no lengthvar is provided we now assign priority '1' by default
577
+ data << [ fname, lname, translation, plurality = "", lengthvariant = "1" ]
576
578
  end
577
579
  end
578
580
  io.close
@@ -604,14 +606,15 @@ module MobyUtil
604
606
  sql_file = File.open(table_name + ".#{db_connection.db_type}.sql", 'a') if record_sql
605
607
 
606
608
  # CREATE TABLE if doesn't exist (language columns to be created as needed)
609
+ # When no lengthvar is provided we now assign priority '1' by default
607
610
  case db_connection.db_type
608
611
  when "mysql"
609
612
  query_string = "CREATE TABLE IF NOT EXISTS " + table_name + " (
610
613
  `ID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
611
614
  `FNAME` VARCHAR(150) NOT NULL COLLATE latin1_general_ci,
612
615
  `LNAME` VARCHAR(150) NOT NULL COLLATE latin1_general_ci,
613
- `PLURALITY` VARCHAR(50) COLLATE latin1_general_ci,
614
- `LENGTHVAR` INT(10),
616
+ `PLURALITY` VARCHAR(50) NULL DEFAULT NULL COLLATE latin1_general_ci,
617
+ `LENGTHVAR` INT(10) NULL DEFAULT '1',
615
618
  PRIMARY KEY (`ID`),
616
619
  UNIQUE INDEX `FileLogicNameIndex` (`FNAME`,`LNAME`, `PLURALITY`, `LENGTHVAR`),
617
620
  INDEX `LNameIndex` (`LNAME`)
@@ -623,8 +626,8 @@ module MobyUtil
623
626
  `ID` INTEGER PRIMARY KEY AUTOINCREMENT,
624
627
  `FNAME` VARCHAR(150) NOT NULL,
625
628
  `LNAME` VARCHAR(150) NOT NULL,
626
- `PLURALITY` VARCHAR(50),
627
- `LENGTHVAR` INT(10));"
629
+ `PLURALITY` VARCHAR(50) DEFAULT NULL,
630
+ `LENGTHVAR` INT(10) DEFAULT '1');"
628
631
  MobyUtil::DBAccess.query( db_connection, query_string )
629
632
  sql_file.write( query_string + "\n" ) if record_sql
630
633
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testability-driver
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 2
10
- version: 1.0.2
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Testability Driver team
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin/
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-21 00:00:00 +02:00
18
+ date: 2011-01-25 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency